static void RemoveClsidFromRegistry(bool is64bit, string clsid) { RegistryHandle regKey = RegistryHandle.GetBitnessHKCR(is64bit); string baseKey = "Clsid\\" + clsid; regKey.DeleteKey(baseKey + "\\InprocServer32"); regKey.DeleteKey(baseKey + "\\ProgID"); regKey.DeleteKey(baseKey); }
public static void CreateRegistryKey(bool is64bit, Guid clsid, string module) { using (RegistryHandle regKey = RegistryHandle.GetBitnessHKCR(is64bit)) { using (RegistryHandle clsidKey = regKey.CreateSubKey(@"clsid\" + clsid.ToString("B"))) { clsidKey.SetValue("", ListenerWSUName); using (RegistryHandle inprocServer32Key = clsidKey.CreateSubKey("InprocServer32")) { inprocServer32Key.SetValue("", module); inprocServer32Key.SetValue("ThreadingModel", "Both"); } using (RegistryHandle progID = clsidKey.CreateSubKey("ProgID")) { progID.SetValue("", ListenerWSUName); } } } }