If I remember correctly for target .Net version 4.0, one can use
OpenBaseKey
function like below:
RegistryKey registryKeyA;
if (Environment.Is64BitOperatingSystem)
{
registryKeyA = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
}
else
{
registryKeyA = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32);
}
Refer:
MSDN: RegistryKey.OpenBaseKey Method [
^]