- NSIS Discussion
- Write reg.file not into Wow6432Node
Archive: Write reg.file not into Wow6432Node
pozbremser
8th September 2008 16:21 UTC
Write reg.file not into Wow6432Node
hello,
I used the next line to write into registry.
ExecWait 'regedit.exe /s "C:\registry\regfile01.reg"'
ExecWait 'regedit.exe /s "C:\\registry\regfile02.reg"'
regfile01.reg has keys for HKEY_CURRENT_USER
regfile02.reg has keys for HKEY_LOCAL_MACHINE
on windows xp prof. 32 bit
and on vista 32 bit is all OK!
on windows xp prof. 64 bit
and on vista 64 bit
regfile01.reg write into HKEY_CURRENT_USER\Software\myCompany
regfile02.reg write into HKEY_CURRENT_USER\Software\Wow6432Node\myCompany
Can I "say" to regedit.exe write into
regfile01.reg write into HKEY_CURRENT_USER\Software\myCompany on 64 Bit Systems?
Thanks!
Comperio
8th September 2008 17:45 UTC
This might work: (try it and see as I don't have a 64-bit computer available at the moment.)
!include x64.nsh
...
${DisableX64FSRedirection}
ExecWait 'regedit.exe /s "C:\registry\regfile01.reg"'
ExecWait 'regedit.exe /s "C:\registry\regfile02.reg"'
${EnableX64FSRedirection}
The only caveat is that it's not clear to me if this affects REGISTRY functions. (There's also a chance it may not work on ExecWait or Exec.)
The macro just calls the system.dll to call the API function
Wow64EnableWow64FsRedirection. You might get more info by searching MSDN.
Anders
8th September 2008 17:46 UTC
use the nsis registry functions and SetRegView
pozbremser
9th September 2008 09:39 UTC
thanks!
I will try DisableX64FSRedirection.
regfiles have many entries,
and if I need to add another entry into registry or
change it, I shall compile installer.
It's comfortably to use regedit.
installer call regedit and data be written under Wow6432Node on 64 Bit Systems.
Is it because installer was created on 32 Bit-Systems?
What do You meen about creating an application supported 32 and 64 Bit, that call "right" regedit,
and than call this application from installer?
pozbremser
9th September 2008 10:23 UTC
@Comperio
${DisableX64FSRedirection}
ExecWait 'regedit.exe /s "C:\registry\regfile01.reg"'
ExecWait 'regedit.exe /s "C:\registry\regfile02.reg"'
${EnableX64FSRedirection}
it work on Windows XP Professional
it work on Windows XP Professional x64 !
it doesn't work on Windows Vista x64 Edition.
Comperio
9th September 2008 16:03 UTC
Have a look at the MSDN article in my last post. It references a newer function:
This function may not work reliably when there are nested calls. Therefore, this function has been replaced by the Wow64DisableWow64FsRedirection and Wow64RevertWow64FsRedirection functions.
Maybe you have to use the newer function on Vista?
pozbremser
9th September 2008 16:58 UTC
${DisableX64FSRedirection}
ExecWait 'regedit.exe /s "C:\registry\regfile01.reg"'
ExecWait 'regedit.exe /s "C:\registry\regfile02.reg"'
${EnableX64FSRedirection}
it work on Windows XP Professional 32
it work on Windows XP Professional 64 !
it work on Windows Vista 32 Edition.
it work on Windows Vista 64 Edition.
it didn't run on Vista 32\64 with
RequestExecutionLevel user and UAC On
Anders
9th September 2008 23:28 UTC
Exec and ExecWait are useless on exe files you don't control when it comes to Vista (If an exe is marked as requireAdmin in the manifest, CreateProcess just returns with a error, use ExecShell if you want elevation prompts or mark your installer as requireAdmin with requestexecutionlevel)
pozbremser
10th September 2008 13:22 UTC
Function .onInit
SetRegView 64
FunctionEnd
Function Un.onInit
SetRegView 64
FunctionEnd
${DisableX64FSRedirection}
ExecWait 'regedit ...'
${EnableX64FSRedirection}
it works on xp 32\64, vista 32\64
without I'm checking 64-Bit System.
it doesn't work
${DisableX64FSRedirection}
ExecWait 'msiexec ...'
${EnableX64FSRedirection}
msiexec enabled WOW-redirection or doesn't check it
and write into
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{myProductCode}]