I'm working on a 64-bit Windows and runs my avatar with high privileges. I have a problem with the following very simple code:
myKey = Registry.LocalMachine.OpenSubKey (@ "software \ microsoft windows \ currentVersion \ run"); If (myKey! = Null) {string [] HKLMvaluenames = myKey.GetValueNames (); }
But for some reasons the HKLMvaluenames array is populated with values by the following keys:
HKEY_LOCAL_MACHINE \ SOFTWARE \ WOW6432Node \ Microsoft \ Windows CurrentVersion \ Run < / Code>
Is there a way to this problem?
This is by design, 32-bit programs have a different registry than 64-bit programs The approach is. They are redirected to the HKLM \ Software \ Wow6432Node key when they try to read a value from HKLM \ Software Honeycomb if you build your C # program with Project + Properties, build tab, platform target = any CPU If it does, it will run as a 64-bit program and will not be redirected.
The 32-bit program can cancel the redirection but it has not been easily with the .NET registry class. With the KEY_WOW64_64KEY option, it is necessary to P / adopt RegOpenKeyEx. More information about this is available.
EDIT: This is now the .NET 4 specific registry. Openbuske () method is also available on the net. See Registry view to see the registry view in the 64-bit process.
Comments
Post a Comment