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!