1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| private static bool CheckSoftWartInstallState(string softWareName) { Microsoft.Win32.RegistryKey uninstallNode = Microsoft.Win32.Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.ReadKey); foreach (string subKeyName in uninstallNode.GetSubKeyNames()) { Microsoft.Win32.RegistryKey subKey = uninstallNode.OpenSubKey(subKeyName); object displayName = subKey.GetValue("DisplayName"); if (displayName != null) { if (displayName.ToString().Contains(softWareName)) { return true; } } } return false; }
|