このキー内のサブキーのすべての表示名を取得しようとしています。
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
このコードで:
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);
}
コードを実行した後、必要なキーの1つが見つかりません。
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}
また、表示名はMicrosoft Visual C ++ 2010 x64 Redistributable-10.0.30319である必要がありますが、代わりに、GetSubKeyNames()
メソッドはサブキーを提供します:{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}.KB2151757
これには表示名がありません。
必要な正確なサブキー({DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}
)を取得できないのはなぜですか?また、どうすれば取得できますか?