Reputation: 3304
I am making the wrapper for my application through NSIS setup. In the wrapper I need to do some registry entries for my application. The entries will be in the registry path “HKLM\SOFTWARE\Wow6432Node\Microsoft” and “HKLM\SOFTWARE\ Microsoft”.
The problem is when I am importing the registry through the [ExecWait ”regedit.exe /s registry.reg”] command in the NSIS, the registry entry will not be added to the path “HKLM\SOFTWARE\ Microsoft”, only in other entry it will be added. And along with this in NSIS setup there will be a new entry in the path “HKLM\SOFTWARE\Wow6432Node\Wow6432Node \Microsoft” which is come from nowhere, because I did not include any registry entry mentioned like that in the registry file.
I checked the registry file and there was no problem in it. I tried by directly running the registry file and also tried the same command directly in a bat file as well as CMD (regedit.exe /s registry.reg ). All are working fine. Only in NSIS it is not working. Any help would be great.
EDIT: Operating system: windows 7, 64 Bit
NSIS version: 2.46
Upvotes: 1
Views: 745
Reputation: 101559
Just calling Exec "regedit.exe"
from a 32-bit application will start 32-bit Regedit and that causes the Wow6432Node\Wow6432Node issue.
The real solution is to use Reg2Nsis or some other conversion tool to convert your .reg file into WriteRegStr
and SetRegView
instructions.
You can try running 64-bit Regedit with this ugly hack:
!include x64.nsh
${DisableX64FSRedirection}
ExecWait '"$WinDir\Regedit.exe" /whatever'
${EnableX64FSRedirection}
Upvotes: 1
Reputation: 2089
I guess that your application nsis installer is for 32bit. Since it is a 32bit installer every registry operation is automatically converted by windows applying the compatibility key "Wow6432Node". see this link about registry redirection
for switching between 32-bit and 64-bit registry your code should looks like:
SetRegView 64
WriteRegDWORD HKLM "SOFTWARE\<Key1>\<Key2>" "Value" 0
SetRegView 32
WriteRegStr HKLM "SOFTWARE\<Key1>\<Key2>" "Value" "1"
since nsis has its own native functions for modifying the windows registry, using ExecWait regedit.exe /s registry.reg
is not a good idea
Upvotes: 1