0

How do I open the HKLM\Software\myApp key (x86) and HKLM\Software\Wow6432Node\myApp key (x64) in C# using the same code. I've read about OpenBaseKey, but unfortunately I have an earlier version of .Net, not 4+.

I've tried the below code because I expected (like in C++) that the path would be automatically resolved, but it seems it wasn't.

RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software");
key = key.OpenSubKey("myApp");
if (key == null) // <<<< key is null on x64 machines
    return false;

Thanks!

Iosif Murariu
  • 2,019
  • 1
  • 21
  • 27
  • 1
    http://stackoverflow.com/questions/26217199/what-are-some-alternatives-to-registrykey-openbasekey-in-net-3-5 – ken2k Nov 04 '14 at 15:31
  • It is available since 4.0, getting stuck on 6+ year old version of free software is a problem you can't get help with. The other obvious workaround is to change the Platform target to AnyCPU so the redirector doesn't redirect. – Hans Passant Nov 04 '14 at 15:33
  • but i WANT to get redirected – Iosif Murariu Nov 04 '14 at 15:41

0 Answers0