C# reads wrong registry data on 64-bit OS
Posted
by baal80
on Stack Overflow
See other posts from Stack Overflow
or by baal80
Published on 2010-05-16T12:50:34Z
Indexed on
2010/05/16
13:00 UTC
Read the original article
Hit count: 151
I'm working on a 64-bit Windows and my applicaiton runs with elevated privileges. I have a problem with the following very simple piece of code:
myKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
if (myKey != null)
{
string[] HKLMvaluenames = myKey.GetValueNames();
}
But for some reason HKLMvaluenames array is populated with values from the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
Is there a way around this problem?
© Stack Overflow or respective owner