Last active
August 29, 2015 14:04
-
-
Save bpatra/bd641ee939f2c70ed3d9 to your computer and use it in GitHub Desktop.
Choosing the proper registry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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