Archive: Problems writing to registry


Problems writing to registry
I'm seeing some really odd behavior from NSIS on trying to write/delete to the registry.

I have a number of calls to WriteRegStr that work fine in my script. However, I also have a large number that are silently failing. Coincidentally, the ones that fail all seem to be in HKLM. I'm verifying by simply going into the registry on my development machine and observing which changes have or have not been made.

I am executing this before any of the sections in my installer:
; Request application privileges for Windows Vista
RequestExecutionLevel admin

I included a function like this to test for errors write after the registry writes and it returns Ok:
Function Test
ifErrors errorlabel
MessageBox MB_OK "OK"
quit
errorlabel:
MessageBox MB_OK "Error"
FunctionEnd

Incredibly, I've now tried to simply compile example2.nsi that comes with NSIS and none of the writes in that seem to be making it to the registry. The relevant writes there are:
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\NSIS_Example2 "Install_Dir" "$INSTDIR"

; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "DisplayName" "NSIS Example2"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Example2" "NoRepair" 1

Does anyone have any idea what is going on and what I can do to make example2 work?


Are you running 64-bit Windows? By default since NSIS makes 32-bit setups, they actually write to "HKEY_LOCAL_MACHINE\Software\Wow6432Node\".


Thanks, you're right!

I didn't know there were a separate set of reg keys there on 64-bit systems.