I try to access certain Registry subkeys, but I can't see certain subkeys.
I run a 32-bit application in a 64-bit edition of Windows. I saw this question, but I don't know where to put the following line:
RegistryBase = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
In my code:
string registry_key = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
using(Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
{
foreach(string subkey_name in key.GetSubKeyNames())
{
using(RegistryKey subkey = key.OpenSubKey(subkey_name))
{
if(subkey!=null)
Console.WriteLine(subkey.GetValue("DisplayName"));
}
}
}