Archive: Using Plugins


Using Plugins
I am trying to use the Registry Plugin

The helps says to use the syntax ${registry::Read}.
However, this gives me the error.
Invalid command: ${registry::Read}

I looked up the plugins found which are printed at the start of the compiler output & saw that all the functions look like this

- Registry::_Read
- Registry::_ReadExtra

etc.


So I next tried (note leading underscores)

Registry::_Read "HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.0\" "Install" $R0 $R1
MessageBox MB_OK $R0
MessageBox MB_OK $R1

The command compiled, but both the messageboxes gave blank output.

The key does exist & has a value in my registry.

What am I doing wrong here?


UPDATE: I got the issue. I hadn't included registry.nsh!!!!
First time I am using a plugin - didn't realize I had to do this.


Not all plug-ins require you to include a header. But some of them do have some of the functionality implemented in a header file. Sometimes it's just a wrapper around the raw plug-in calls to make your life easier and sometimes it's a bit more.


!define registry::Read `!insertmacro registry::Read`
!macro registry::Read _PATH _VALUE _STRING _TYPE
registry::_Read /NOUNLOAD `${_PATH}` `${_VALUE}`
Pop ${_STRING}
Pop ${_TYPE}
!macroend

${registry::Read} "HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.0\" "Install" $R0 $R1

Expanding the macro it exactly equals to:
Registry::_Read "HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v3.0\" "Install"
Pop $R0
Pop $R1