Forum posts for regedit.exe

OpenSubKey() returns null for a registry key that I can see in regedit.exe

I'm trying to get all the display names of the sub keys within this key:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall


With this code:



RegistryKey newKey;
string val;

string KeyPath64Bit = @'SOFTWAREMicrosoftWindowsCurrentVersionUninstall';
RegistryKey mainKey = Registry.LocalMachine.OpenSubKey(KeyPath64Bit);

string[] RegKeys64Bits = Registry.LocalMachine.OpenSubKey(KeyPath64Bit).GetSubKeyNames();

foreach (string s in RegKeys64Bits)
{
newKey = mainKey.OpenSubKey(s);
val = newKey.GetValue('DisplayName', -1, RegistryValueOptions.None).ToString();
if (val != '-1')
file64.WriteLine(val);
}


After running the code I can't find one of the keys I need:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionUninstall{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}


And it should have the display name: Microsoft Visual C++ 2010 x64 Redistributable - 10.0.30319, but instead the GetSubKeyNames() method gives me the sub key : {DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}.KB2151757 which doesn't have any display name.

Why can't I get the exact sub key I need ({DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}) and how can I get it?

View complete forum thread with replies

Other posts related to regedit.exe

See Related Forum Messages: Follow the Links Below to View Complete Thread

.abc branch in regedit.exe
How does regedit.exe create empty binary values
Why I can't see 'wow6432node' when using process.start(“regedit.exe”)?
OpenSubKey() returns null for a registry key that I can see in regedit.exe
How to detect Java is installed via REGEDIT.exe from a batch file?
How can I run the regedit.exe from a Perl script on Windows 2008 Server?
Why does registryKey.GetValue still read the old value after I changed the rgistry with rege…

What is the carbon footprint of your coffee?

Is it low? Is it high? Can this things really kill the planet Earth? Maybe the answer will surprise you. Maybe not.