【发布时间】:2014-07-23 11:20:14
【问题描述】:
我尝试获取已安装应用程序密钥的列表:
RegistryKey RegKeyUninstallList = Registry.LocalMachine;
string strUninstallList = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
string[] test = RegKeyUninstallList.OpenSubKey(strUninstallList).GetSubKeyNames();
我只从以下位置获取密钥:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
但我还需要以下密钥:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
我的程序应该能够在64Bit 和32Bit 机器上运行。
编辑:好的,我已经尝试过 Check if application is installed in registry 和来自 tHiNk_OuT_oF_bOx 的解决方案。
但问题没有解决!
问题是我得到了完全相同的 test 和 test2 列表:
RegistryKey RegKeyUninstallList = Registry.LocalMachine;
string strUninstallList = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
string strUninstallList2 = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall";
string[] test = RegKeyUninstallList.OpenSubKey(strUninstallList).GetSubKeyNames();
string[] test2 = RegKeyUninstallList.OpenSubKey(strUninstallList2).GetSubKeyNames();
【问题讨论】:
-
您不应该改用 WMI 吗? technet.microsoft.com/en-us/library/ee156540.aspx
标签: c# x86-64 regedit installed-applications