This can't be right but it's happening to me. I have the following function:
private static bool KeyExists(RegistryKey key, string search)
{
//GetSubKeyNames is busted...
foreach (string subKey in key.GetSubKeyNames())
{
if (subKey.Trim().Equals(search.Trim()))
{
return true;
}
}
return false;
}
If I put the line String[] names = key.GetSubKeyNames() and have a look in the debugger, I see that the listed names are not what I see in regedit. For example I have a piece of software installed which appears in the Wow6432Node subkey but it pops up if I search for it in the normal Software subkey. Any ideas?
Thanks, brian
The Wow6432 key contains the registry keys that a 32-bit program sees. Project + Properties, Build tab, check your Platform target setting. It defaults to x86 in VS2010.
Registry redirection can be changed but not with the .NET RegistryKey class. You'd have to pinvoke the registry API functions. More background info is available in the SDK.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With