Having a problem with changing value of a subkey of HKEY_LOCAL_MACHINE. When I update the value with ssCore.Registry.setValue it updates the value in WOW6432Node. I found that it happens when a 32bit app tries to change registry on 64bit system. Is there a way to redirect it to actual subkey instead of WOW6432Node?
I have tried "regwrite.exe" of forum thread #6441, but its also not working.
The regwrite.exe utility is still a 32-bit app so the writes are affected by the automatic registry redirection that Windows performs. I need to add support for some flags to the registry functions that will allow you to target either the 32-bit or 64-bit registry as described in Accessing an Alternate Registry View.
I have tried executing a batch file through this application, but its still updating value in Wow6432Node key. Executing batch file normally updates at correct place.
Batch command I tried:
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "test.exe" /f
Did you verify that just running your BAT file manually updates the correct part of the registry?
Did you use Shell.open or Shell.execute to launch the BAT file?
If you used Shell.execute then the BAT file will be a child of the parent process so it will still be running as a 32-bit process. If you use Shell.open, the child should run as a 64-bit process on a 64-bit machine.
I have verified that running the bat file manually is updating at correct place in registry. And Yes, I am using Shell.execute to run this bat file. I'll update my code to use Shell.open and will let you know the result.
Shell.execute and Shell.open both are making registry entry in same place (Wow6432Node). But adding " /reg:64" in bat command has resolved the issue. New bat command is:
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Shell /t REG_SZ /d "abcd.exe" /f <B>/reg:64</B>
After updating the command, Shell.execute and Shell.open both are making entry in correct place. I have verified it on 64-bit and 32-bit both devices.