Skip to content
⌘ NSIS Forum Archive

Registry plugin

229 posts

mikhail78#
Is this a 64-bit system?
Anders, thank you for your response. The problem was indeed related to 64-bit Windows, and went away after I had re-read this thread, and figured out that I needed to add SetRegView 64 to the script.

If I may make a suggestion to those who maintain the documentation for the registry plugin - you might want to consider adding some explanations regarding the 32/64-bit modes, as some users (as myself) might be unaware of the SetRegView command, or believe (falsely) that it only affects the built-in NSIS commands (EnumRegValue, etc.)

Again, thank you for your help.
Instructor#
Originally Posted by rvintonyak View Post
Does this plugin support unicode or it is for ANSI only?
Yes, last version (4.1 at the moment) fully unicode compatible (ofcourse you should use unicode NSIS).
Originally Posted by piaranda View Post
Hello, I´m executing a script with Registry.dll (Windows 8) to look for some keys under HKU node, but for some reason, application crashes in a find call (when some nodes have already been found). I have tried to run RegistryTest.exe with the example of "Search for value 'Content Type'", but replacing HKEY_CURRENT_USER with HKEY_USERS and the result is the same: at some point, app crashes.
Not reproduced. In RegistryTest.nsi specified HKEY_LOCAL_MACHINE not HKEY_CURRENT_USER. Do you sure you use original RegistryTest.nsi code?
Anders#
Originally Posted by Carl_Zeiß View Post
Does it work with NSIS 3?
The plug-in API has not changed at all for NSIS 3.
Carl_Zeiß#
Ok, thanks.
I get an errormessage while compiling my script with NSIS 3.0rc1, and i have no idea:


[...]
!include: "C:\Program Files (x86)\NSIS\Include\Registry.nsh" (ACP)
!define: "registry::Open"="!insertmacro registry::Open"
...
!define: "registry::Unload"="!insertmacro registry::Unload"
!include: closed: "C:\Program Files (x86)\NSIS\Include\Registry.nsh"
[...]
!insertmacro: registry::KeyExists
Plugin not found, cannot call registry::_KeyExists
Error in macro registry::KeyExists on macroline 1
[...]
this ist the code within the script:


${registry::KeyExists} "HKEY_LOCAL_MACHINE\....\PendingFileNameOperations" $R0
Anders#
It says it right there ...Plugin not found... Put the plugin in the correct subfolder under NSIS\Plugins\...
ConnivingCritic#
Registry plugin v4.1 reading past 3rd subkey.

Hello,
This beginner doesn't know what I'm possibly doing wrong, but I cannot get the KeyExists to recognize a key past the third sub key? or read a value past a third key. Can anyone help me? I'm modifying the RegistryTest example from the example to test.

${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL NT Server" $R0
$RO = -1

${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products" $R0
$RO = 0

${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Btrieve Requester\Version 11\Settings" $R0
$RO = -1

I also get no value info past the third subkey reg_sz value.
${registry::Read} "HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL NT Server\InstallInfo" "ProductVersion" $R0 $R1
MessageBox MB_OK 'registry::Read$\n$\n\
$$R0 "string" =[$R0]$\n\
$$R1 "type" =[$R1]$\n'
Anders#
Originally Posted by ConnivingCritic View Post
I cannot get the KeyExists to recognize a key past the third sub key?
That sounds very strange. Is this a 64-bit version of Windows? If so, you have to remember that there are two views of the registry, 64-bit and 32-bit and they are not always the same. What you see in Regedit might not be the same as what a 32-bit program sees. You could run %windir%\syswow64\regedit.exe to get the 32-bit version or maybe try Process Monitor to see if the key is really there or not. Or simply add a WriteRegStr first so you know the data is there.
ConnivingCritic#
Registry plugin not reading

I agree this is very strange and makes no sense. The plugin will not read for me the Pervasive.SQL NT Server. I have tested the below code with the below registry on a 64bit win8 and win10. I double checked that I have the plugin registry.dll and Include Registry.nsh. Here is the registry I'm trying to read: and below its the code I'm using. I have no idea what I am doing wrong. I really would like the ability to read the registry keys below. Can you help me?
Thank you!
------------------------------------
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products]
@=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\OneTwoThree]
[HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\OneTwoThree\InstallInfo]
[HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL Client]
@=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL Client\InstallInfo]
"ProductVersion"="12.00.160"
@=""
"InstallData"="C:\\ProgramData\\Actian\\PSQL\\"
"InstallDir64"="C:\\Program Files\\Actian\\PSQL\\"
"InstallDir"="C:\\Program Files (x86)\\Actian\\PSQL\\"
"VersionLevel"="12.00"
[HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL NT Server]
[HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL NT Server\InstallInfo]
"ProductVersion"="12.11.011"
@=""
"InstallData"="C:\\ProgramData\\Actian\\PSQL\\"
"InstallDir64"="C:\\Program Files\\Actian\\PSQL\\"
"InstallDir"="C:\\Program Files (x86)\\Actian\\PSQL\\"
"VersionLevel"="12.11"
-------------------------------------
;NSIS code
!define PRODUCT_NAME "Configure PSQL 12.11"
!define PRODUCT_VERSION "PSQL 12.11 "
!include "LogicLib.nsh"
!include "Registry.nsh"
Page instfiles
;---------------------------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Configure PSQL 12.11.exe"
InstallDir "$DESKTOP"
ShowInstDetails nevershow
Section "MainSection" SEC01
;--------------
${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\OneTwoThree\InstallInfo" $R0
MessageBox MB_OK "registry::KeyExists$\n$\n\
Errorlevel: [$R0] OneTwoThree exists"
${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL Client\InstallInfo" $R0
MessageBox MB_OK "registry::KeyExists$\n$\n\
Errorlevel: [$R0] Client exists"
${registry::KeyExists} "HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL NT Server\InstallInfo" $R0
MessageBox MB_OK "registry::KeyExists$\n$\n\
Errorlevel: [$R0] Server exists"
${registry::Read} "HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL Client\InstallInfo" "ProductVersion" $R0 $R1
MessageBox MB_OK 'registry::Read$\n$\n\
$$R0 "string" =[$R0]$\n\
$$R1 "type" =[$R1]$\n'
${registry::Read} "HKEY_LOCAL_MACHINE\SOFTWARE\Pervasive Software\Products\Pervasive.SQL NT Server\InstallInfo" "ProductVersion" $R0 $R1
MessageBox MB_OK 'registry::Read$\n$\n\
$$R0 "string" =[$R0]$\n\
$$R1 "type" =[$R1]$\n'

SectionEnd
ConnivingCritic#
Solved - SetRegView 64 solved my problem with using the Registry Plugin. Thank you Anders for clueing me in to how the plugin was reading. The registry keys I wanted were only found in the x64bit registry and not in the x86bit. Which the Registry Plugin was reading only the 32bit by default. By using the SetRegView 64 the Registry Plugin reads it correctly.
GustavoHennemann#
Hi guys,
I'm very new in NSIS and I'm trying to find a string in the windows registry that identifies my application, but I'm facing problems with win32 and win64.
In my pc (Win10 64bits) I have the following registries:
Computador\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QUANT MetaTrader 5
Computador\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\QUANT MetaTrader 5 TRIAL
and
Computador\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MetaTrader 5
Computador\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MetaTrader 5 Terminal
Computador\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MetaTrader XP
Computador\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\QUANT MetaTrader 5 TRIAL

I'm using this function to find the regs:
* APP_NAME_MT5 = "Metatrader"

Function SearchValueReg
Var /GLOBAL schHandle
Var /GLOBAL schPath
Var /GLOBAL schValue
Var /GLOBAL schString
Var /GLOBAL schType
Var /GLOBAL insFullPath
Var /GLOBAL insPath

SetRegView 32
${registry::Open} "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" "/K=0 /V=1 /S=0 /B=1 /NI=${APP_NAME_MT5}" $schHandle

${Do}
${registry::Find} "$schHandle" $schPath $schValue $schString $schType
${If} $schType != ""
MessageBox MB_OK "$schValue"
${EndIf}
${LoopUntil} $schType == ""

${registry::Close} "$srcHandle"
${registry::Unload}

FunctionEnd

if I use SetRegView 32, I got 2 registries.
But, if I use SetRegView 64, I got nothing.

What I'm doing wrong?

Thanks in advance.
Anders#
"/K=0 /V=1 ..." means you are searching for values, not keys. If you want to search for values then make sure all the DisplayName values actually contain your string.

If it still does not work, make sure you are using the latest version of the plug-in and watch it access keys with Process Monitor to see where it actually reads.
mordack#
I have a question. Using the following code, I am able to find the uninstall GUID key i'm looking for.

${registry::Open} "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" "/K=0 /V=0 /S=1 /B=1 /NI=Microsoft SQL Server 2012 Native Client" $r0
MessageBox MB_OK "$r0"
${registry::Find} "$r0" $schPath $schValue $schString $schType
$schPath finds the path of the key based on the DisplayName string.

The search finds \Software\Microsoft\Windows\CurrentVersion\Uninstall\{GUID}. I need to extract {GUID} from the search results. How would I go about doing this?


Thanks.
Anders#
You can just use the normal NSIS instruction? You are not really supposed to create keys in the CU and LM roots, only use Software or System.
jooseng#
I am creating portable app launcher not installer. It is some software developer like to write to that location. Yes in this situation I use the build in command.
I wish the plugin can handle this so I do not need to use 2 sets of comand at the same time which easily mix up and cause syntax error.​