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?