diff --git a/MyComputerManager/Helpers/NamespaceHelper.cs b/MyComputerManager/Helpers/NamespaceHelper.cs index f4b6c30..48d9c56 100644 --- a/MyComputerManager/Helpers/NamespaceHelper.cs +++ b/MyComputerManager/Helpers/NamespaceHelper.cs @@ -66,14 +66,14 @@ public static List GetItemsInternal(RegistryKey rootkey, bool dis } if (itemkey == null) { - clsidrootkey = Registry.CurrentUser; - clsidkey = clsidrootkey.OpenSubKey(@"SOFTWARE\Classes\WOW6432Node\CLSID", false); + clsidrootkey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32); + clsidkey = clsidrootkey.OpenSubKey(@"SOFTWARE\Classes\CLSID", false); itemkey = clsidkey.OpenSubKey(item, false); } if (itemkey == null) { - clsidrootkey = Registry.LocalMachine; - clsidkey = clsidrootkey.OpenSubKey(@"SOFTWARE\Classes\WOW6432Node\CLSID", false); + clsidrootkey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); + clsidkey = clsidrootkey.OpenSubKey(@"SOFTWARE\Classes\CLSID", false); itemkey = clsidkey.OpenSubKey(item, false); } if (itemkey != null) @@ -89,7 +89,7 @@ public static List GetItemsInternal(RegistryKey rootkey, bool dis string exepath = (string)(exekey?.GetValue("") ?? ""); if (name == "") continue; - list.Add(new NamespaceItem(name, desc, tip, exepath, iconpath, rootkey, clsidkey, disabled, item)); + list.Add(new NamespaceItem(name, desc, tip, exepath, iconpath, rootkey, clsidrootkey, disabled, item)); } } return list; @@ -105,7 +105,7 @@ public static CommonResult UpdateItem(NamespaceItem item) var namespaceSubKey = namespaceKey.CreateSubKey(item.CLSID, true); if (namespaceSubKey == null) return new CommonResult(false, "找不到Namespace下的" + item.CLSID); - var clsidKey = item.RegKey1; + var clsidKey = item.RegKey1.CreateSubKey(@"SOFTWARE\Classes\CLSID", true); if (clsidKey == null) return new CommonResult(false, "找不到CLSID key"); var clsidSubKey = clsidKey.CreateSubKey(item.CLSID, true); @@ -196,7 +196,7 @@ public static CommonResult DeleteItem(NamespaceItem item) return new CommonResult(false, "找不到Namespace key"); namespaceKey.DeleteSubKeyTree(item.CLSID, false); - var clsidKey = item.RegKey1; + var clsidKey = item.RegKey1.OpenSubKey(@"SOFTWARE\Classes\CLSID", true); ; if (clsidKey == null) return new CommonResult(false, "找不到CLSID key"); clsidKey.DeleteSubKeyTree(item.CLSID, false); diff --git a/MyComputerManager/MainWindow.xaml b/MyComputerManager/MainWindow.xaml index 7dd6c47..fdb90a5 100644 --- a/MyComputerManager/MainWindow.xaml +++ b/MyComputerManager/MainWindow.xaml @@ -78,7 +78,7 @@ -