Archive: Write reg.file not into Wow6432Node


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!


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.

use the nsis registry functions and SetRegView


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?


@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.


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?

${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


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)


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}]