If you can change the target .Net version to v4, then you can use the new OpenBaseKey function e.g.
RegistryKey registryKey;
if (Environment.Is64BitOperatingSystem == true)
{
registryKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64);
}
else
{
registryKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry32);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…