0

I have a program which writes values to the registry.

I has a GUI mode and a command line mode. The program writes to HKLM perfectly when running in GUI mode (x86 build config)

However when i run my program in command mode, the values are written under the wow6432 node. I have done some research and found that the wow6432 node is used to store the registry values of a 32bit application which has been run on a 64bit machine.

I wouldn't have thought that running in command line mode would change from 64bit to 32 - but it seems to be.

Not really sure where to go from here, hopefully someone can point me in the right direction.

Build Config

DNKROZ
  • 2,634
  • 4
  • 25
  • 43
  • If your program writes to HKLM (*without* WOW6432Node) and you are using a 64-Bit operating system, then your are **not** executing an x86 build of your application. Please double-check the build config of your GUI application. – Heinzi May 27 '14 at 09:34
  • Strange - it's definitely set to x86. If i set it to any CPU, then it will only write to wow6432 – DNKROZ May 27 '14 at 09:37
  • That's even stranger, it should be the exact opposite. :-) – Heinzi May 27 '14 at 09:39
  • Yeah not sure whats going on - added my build config to the question – DNKROZ May 27 '14 at 09:40

1 Answers1

0

After a bit more research - i found that when running in command line mode the registry re director was redirecting to the wow6432 node.

To bypass this, i used :

RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)

This then opens the 64 bit view directly, and allows HKLM to be written to without being re directed to the wow6432 node.

DNKROZ
  • 2,634
  • 4
  • 25
  • 43