-1

I am trying to make changes in the windows 7 x64 registry. I already had code to change registry keys for 32bit systems and some of those also work on the 64 bit version. However some of them don't and i know it has something to do with the WOW64node, but i just can't get it to work.

Existing code:

regkey = My.Computer.Registry.CurrentUser.OpenSubKey("Control Panel\International", True)       
regkey.SetValue("sDecimal", ",")
regkey.Close()

This works on windows 7 32bit bud not on 64bit. So I tried the following:

rk1 = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64)
rk2 = rk1.OpenSubKey("Control Panel\International", True)
rk2.SetValue("sDecimal", ",")
regkey.Close()

This doesn't work and i guess it is because of not using WOW64node. However when I experiment with it in the code it doesn't run.

This piece of code does work on 64bit funny enough:

regkey = My.Computer.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion\Winlogon", True)      
regkey.SetValue("Shell", "C:\mmi_loader.exe", RegistryValueKind.String)
regkey.Close()

What am i doing wrong? It would be ideal if the code could be adapted in such a way that it would work on both 32bit and 64bit.

Thanks in advance,

F.J
  • 35
  • 10

1 Answers1

0

this code on my windows10 64 bit Pc works:

RegistryKey rk1 = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64);
RegistryKey rk2 = rk1.OpenSubKey("Control Panel\\International", true);
rk2.SetValue("sDecimal", ",");
rk1.Close();
rk2.Close();
  • this code does indeed work. bud I embed it in an WIX build MSI installer and then it does not work. – F.J Nov 05 '15 at 09:22
  • even my old code works when it is not run from the installer, so the problem is not the script itself. – F.J Nov 05 '15 at 09:25