Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Choosing the proper registry
RegistryKey baseRegistryHklm;
RegistryKey baseRegistryHkcu;
if (Environment.Is64BitOperatingSystem) //Use OS not process...
{
baseRegistryHklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
baseRegistryHkcu = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64);
}
else
{
baseRegistryHklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
baseRegistryHkcu = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.