private void ViewInRegEdit(object sender, EventArgs e) { if (this.treeViewAdvResults.SelectedNodes.Count > 0) { BadRegistryKey brk = this.treeViewAdvResults.SelectedNode.Tag as BadRegistryKey; string strSubKey = brk.RegKeyPath; string strValueName = brk.ValueName; RegEditGo.GoTo(strSubKey, strValueName); } }
/// <summary> /// Opens RegEdit.exe and navigates to given registry path and value /// </summary> /// <param name="keyPath">path of registry key</param> /// <param name="valueName">name of registry value (can be null)</param> public static void GoTo(string keyPath, string valueName) { using (RegEditGo locator = new RegEditGo()) { bool hasValue = !string.IsNullOrEmpty(valueName); locator.OpenKey(keyPath, hasValue); if (hasValue) { System.Threading.Thread.Sleep(200); locator.OpenValue(valueName); } } }