Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSIS: Unable to write to registry (HKLM\Software\...) on Windows 7

Tags:

windows-7

nsis

I'm in the process of updating an NSIS installation script from XP to Win7. For unknown reasons the installer is not able to write to the registry if running under Win7, even as Administrator. The embedded UAC manifest in the installer is set to require Administrator rights (by specifying RequestExecutionLevel admin in script). Also, I've tried to right-click the installer and selecting Run as administrator. Turning off UAC in OS does not fix the problem either.

When I run the same installer under XP the registry key is written like it is supposed to.

I paired down my install script to try to isolate the problem:

!define APP_NAME      "MyTestApp"

Name                  "${APP_NAME}"
OutFile               "${APP_NAME} Setup.exe"

RequestExecutionLevel admin
Page instfiles

Section -Core
   SetDetailsView show 

   WriteRegStr HKLM "Software\XyzCompany\${APP_NAME}\Installation" "VersionString" "V0.0.0"

   SetAutoClose false
SectionEnd

On the other hand, I am able to write to restricted folders (e.g. C:\ProgramData) (only admin has write access by default here). Am I missing something really obvious here? Running NSIS 2.45.

like image 374
kashiraja Avatar asked Oct 15 '25 07:10

kashiraja


1 Answers

Use SetRegView to write to the "real" HKLM\Software key on x64.

Use Process Monitor to investigate other registry write issues...

like image 104
Anders Avatar answered Oct 19 '25 15:10

Anders



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!