private void CEVersion_UC_Load(object sender, EventArgs e) { using (RegistryKey Key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall")) foreach (string SubKeyName in Key.GetSubKeyNames()) { using (RegistryKey SubKey = Key.OpenSubKey(SubKeyName)) if (SubKeyName.Contains("Cheat")) { CEStrings[CEStringsNum] = SubKey.GetValue("DisplayName").ToString(); CEVersion_ComboBox.Items.Add(CEStrings[CEStringsNum]); CEStringsNum++; CEStrings[CEStringsNum] = SubKey.GetValue("InstallLocation").ToString(); CEStringsNum++; } } }
private string FindPortFriendlyName(string portname) { string ret_string = ""; try { RegistryKey localmachine = Registry.LocalMachine; RegistryKey reg_system = localmachine.OpenSubKey("SYSTEM"); RegistryKey reg_CurrentControlSet = reg_system.OpenSubKey("CurrentControlSet"); RegistryKey reg_Control = reg_CurrentControlSet.OpenSubKey("Control"); RegistryKey reg_Class = reg_Control.OpenSubKey("Class"); RegistryKey reg_GUID = reg_Class.OpenSubKey("{4D36E96D-E325-11CE-BFC1-08002BE10318}"); if (reg_GUID != null) { foreach (string SubKeyName in reg_GUID.GetSubKeyNames()) { if ("Properties" != SubKeyName.ToString()) { RegistryKey reg_sub = reg_GUID.OpenSubKey(SubKeyName.ToString()); string temp = reg_sub.GetValue("AttachedTo").ToString(); if (portname.ToString() == temp) { ret_string = reg_sub.GetValue("FriendlyName").ToString(); return(ret_string); } } } } } catch (Exception ex) { Debug.WriteLine("[ERROR] " + ex.Message); // if (logger.IsErrorEnabled) logger.Error("[ERROR] " + ex.Message); } return("-"); }