我正在尝试获取此键中子键的所有显示名称:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Run Code Online (Sandbox Code Playgroud)
使用此代码:
RegistryKey newKey;
string val;
string KeyPath64Bit = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
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);
}
Run Code Online (Sandbox Code Playgroud)
运行代码后,我找不到我需要的密钥之一:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}
Run Code Online (Sandbox Code Playgroud)
它应该有显示名称:Microsoft Visual C++ 2010 x64 Redistributable - 10.0.30319,但该GetSubKeyNames()
方法给了我子键:{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}.KB2151757
它没有任何显示名称.
为什么我不能得到我需要的确切子键({DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}
),我怎么能得到它?