Ejemplo n.º 1
0
        public override void executeTest( )
        {
            Console.WriteLine("Test Case 42 :Registry Fault - No Log Space");
            UIFaultIntercepterTest1 t = new UIFaultIntercepterTest1();

            //launch HD
            t.GetHolodeck("No_Log_Space");
            Holodeck.NewProjectPane3.SendKeyStrokes("{TAB}");
            Holodeck.NewProjectPane3.SendKeyStrokes("{TAB}");
            Holodeck.NewProjectPane3.SendKeyStrokes("{TAB}");

            RegistryKey LocalMachine = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, System.Environment.MachineName);
            RegistryKey SoftwareKey  = LocalMachine.OpenSubKey("SOFTWARE", true);
            RegistryKey HolodeckKey  = SoftwareKey.OpenSubKey("HolodeckEE", true);
            RegistryKey InterceptKey;

            do
            {
                Thread.Sleep(500);
                InterceptKey = HolodeckKey.OpenSubKey("FaultIntercepterReady");
            }while(InterceptKey == null);
            Console.WriteLine("Now Setting Fault...");

            //setting a registry fault here
            Holodeck.NewProjectPane3.SendKeyStrokes("{DOWN}");

            RegistryKey FaultIntercepter = HolodeckKey.CreateSubKey("FaultReady");

            Thread.Sleep(26000);
            CheckOutcome();
            HolodeckKey.DeleteSubKey("FaultReady");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Delete the specified key if it is empty.  If that causes its parent key to be empty, continue upwards.
        /// </summary>
        public static void DeleteEmptyKey(string keyname)
        {
            RegistryKey key = OpenKey(keyname, false);

            if (key != null)
            {
                for (; ;)
                {
                    int keycount, valuecount;
                    keycount   = key.SubKeyCount;
                    valuecount = key.ValueCount;

                    key.Close();

                    if (keycount != 0 || valuecount != 0)
                    {
                        break;
                    }

                    int i = keyname.LastIndexOf('\\');
                    if (i == -1)
                    {
                        break;
                    }

                    string subkeyname = keyname.Substring(i + 1);
                    keyname = keyname.Substring(0, i);

                    key = OpenKey(keyname, false);
                    key.DeleteSubKey(subkeyname);
                }
            }
        }
Ejemplo n.º 3
0
        private void clearing_registr(object sender, EventArgs e)
        {
            RegistryKey key = Registry.CurrentUser;

            key.DeleteSubKey(@"Software\hw");
            UpdateRegistrSettings();
        }
Ejemplo n.º 4
0
        private string DelReg(string str, bool isKey)
        {
            string[]    s     = str.Split('\t');
            RegistryKey MyReg = GetRegKey(s[0]);

            if (!isKey)
            {
                try
                {
                    MyReg.DeleteSubKey(s[1]);
                }
                catch (System.InvalidOperationException)
                {
                    try
                    {
                        MyReg.DeleteSubKeyTree(s[1]);
                    }
                    catch { return("0"); }
                }
                catch { return("0"); }
            }
            else
            {
                try
                {
                    MyReg.DeleteValue(s[1]);
                }
                catch { return("0"); }
            }
            return("1");
        }
Ejemplo n.º 5
0
        void DelExt()
        {
            string      ext   = comboBox1.Text;
            RegistryKey uKey  = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\", true);
            RegistryKey u2Key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\" + ext, true);

            foreach (var k in u2Key.GetSubKeyNames())
            {
                u2Key.DeleteSubKey(k);
            }
            uKey.DeleteSubKey(ext);
            RegistryKey cKey  = Registry.ClassesRoot.OpenSubKey(@"\", true);
            RegistryKey c2Key = Registry.ClassesRoot.OpenSubKey(@"\" + ext, true);

            foreach (var k2 in c2Key.GetSubKeyNames())
            {
                c2Key.DeleteSubKey(k2);
            }

            foreach (var val in cKey.GetSubKeyNames())
            {
                if (val.Equals(ext))
                {
                    cKey.DeleteSubKey(val);
                    break;
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 关联文件
        /// </summary>
        /// <param name="_FilePathString">应用程序路径</param>
        /// <param name="p_FileTypeName">文件类型</param>
        public static void SaveReg(string _FilePathString, string p_FileTypeName)
        {
            RegistryKey _RegKey = Registry.ClassesRoot.OpenSubKey("", true);              //打开注册表
            RegistryKey _VRPkey = _RegKey.OpenSubKey(p_FileTypeName, true);

            if (_VRPkey != null)
            {
                _RegKey.DeleteSubKey(p_FileTypeName, true);
            }
            _RegKey.CreateSubKey(p_FileTypeName);
            _VRPkey = _RegKey.OpenSubKey(p_FileTypeName, true);
            _VRPkey.SetValue("", "Exec");
            _VRPkey = _RegKey.OpenSubKey("Exec", true);
            if (_VRPkey != null)
            {
                _RegKey.DeleteSubKeyTree("Exec");                          //如果等于空就删除注册表DSKJIVR
            }
            _RegKey.CreateSubKey("Exec");
            _VRPkey = _RegKey.OpenSubKey("Exec", true);
            _VRPkey.CreateSubKey("shell");
            _VRPkey = _VRPkey.OpenSubKey("shell", true);                      //写入必须路径
            _VRPkey.CreateSubKey("open");
            _VRPkey = _VRPkey.OpenSubKey("open", true);
            _VRPkey.CreateSubKey("command");
            _VRPkey = _VRPkey.OpenSubKey("command", true);
            string _PathString = "\"" + _FilePathString + "\" \"%1\"";

            _VRPkey.SetValue("", _PathString);                                    //写入数据
        }
Ejemplo n.º 7
0
        private void ClearCredentials()
        {
            RegistryKey rk = Registry.CurrentUser;

            rk.DeleteSubKey("Software\\VersionOne\\TFSPolicy\\Credentials", false);
            hasCachedCredentials = false;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Pins shortcut to the taskbar
        /// </summary>
        /// <example>
        /// <code>
        /// Shortcut shortcut = new Shortcut("path to shortcut");
        /// shortcut.PinToStart();
        /// </code>
        /// </example>
        /// <seealso cref="DoVerb"/>
        /// <param name="shortcut"></param>
        public static void PinToTaskBar(this Shortcut shortcut)
        {
            if (currentVersion == "6.1")
            {
                DoVerb(shortcut.Item, "Pin to Tas&kbar");
            }

            if (currentVersion == "6.3")
            {
                string keyPath1  = "shell";
                string keyPath2  = "{:}";
                string valueName = "ExplorerCommandHandler";
                string valueData = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\Windows.taskbarpin", "ExplorerCommandHandler", "").ToString();

                RegistryKey key2 = CMWinRegistry.RegKeyFromString(@"HKLM_CURRENT_USER\SOFTWARE\Classes\*", true);
                RegistryKey key3 = key2.CreateSubKey("shell");
                RegistryKey key4 = key3.CreateSubKey("{:}");
                key4.SetValue(valueName, valueData);

                shortcut.Item.InvokeVerb("{:}");

                key3.DeleteSubKey(keyPath2);
                if (key3.SubKeyCount == 0 && key3.ValueCount == 0)
                {
                    key2.DeleteSubKey(keyPath1);
                }
            }
        }
Ejemplo n.º 9
0
        private void RemoveDebugger()
        {
            if (sethcExists())
            {
                RegistryKey sethc = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options", true);
                sethc.DeleteSubKey("sethc.exe");

                //Configure the MessageBox
                string            message = "Keybind Sucessfully Deleted";
                string            caption = "Success";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;

                // Displays the MessageBox.
                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Information);
            }
            else
            {
                //Configure the MessageBox
                string            message = "The keybind was not bound to begin with.";
                string            caption = "Error";
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                DialogResult      result;

                // Displays the MessageBox.
                result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 10
0
        public Boolean RemoveSubKey(String name, Boolean isRecursive = false, Boolean isThrow = false)
        {
            try
            {
                CheckSafe(true);
                if (isRecursive)
                {
                    _registryKey?.DeleteSubKeyTree(name);
                }
                else
                {
                    _registryKey?.DeleteSubKey(name);
                }

                return(true);
            }
            catch (Exception)
            {
                if (isThrow)
                {
                    throw;
                }
            }

            return(false);
        }
Ejemplo n.º 11
0
        public static void SaveReg(string _FilePathString, string p_FileTypeName)
        {
            RegistryKey key = Registry.ClassesRoot.OpenSubKey("", true);

            if (key.OpenSubKey(p_FileTypeName, true) != null)
            {
                key.DeleteSubKey(p_FileTypeName, true);
            }
            key.CreateSubKey(p_FileTypeName);
            key.OpenSubKey(p_FileTypeName, true).SetValue("", "Exec");
            if (key.OpenSubKey("Exec", true) != null)
            {
                key.DeleteSubKeyTree("Exec");
            }
            key.CreateSubKey("Exec");
            RegistryKey key2 = key.OpenSubKey("Exec", true);

            key2.CreateSubKey("shell");
            key2 = key2.OpenSubKey("shell", true);
            key2.CreateSubKey("open");
            key2 = key2.OpenSubKey("open", true);
            key2.CreateSubKey("command");
            key2 = key2.OpenSubKey("command", true);
            string str = "\"" + _FilePathString + "\" \"%1\"";

            key2.SetValue("", str);
        }
Ejemplo n.º 12
0
        public void SaveToRegistry()
        {
            RegistryKey rootKey = Registry.CurrentUser.OpenSubKey(HKCU_APP, true);

            if (rootKey == null)
            {
                rootKey = Registry.CurrentUser.CreateSubKey(HKCU_APP);
            }

            try
            {
                rootKey.DeleteSubKey(this.ServerName);
            }
            catch
            {
            }

            RegistryKey serverKey = rootKey.CreateSubKey(this.ServerName);

            serverKey.SetValue(REG_WEBCLIENTURL, this.WebClientURL);
            serverKey.SetValue(REG_WEBDAVURL, this.WebDAVURL);
            serverKey.SetValue(REG_CIFSSERVER, this.CIFSServer);
            serverKey.SetValue(REG_USERNAME, this.Username);
            serverKey.SetValue(REG_PASSWORD, this.EncryptedPassword);
            rootKey.SetValue("", this.ServerName);

            m_AuthenticationTicket = "";
        }
Ejemplo n.º 13
0
        public static void UnregisterClass(string key)
        {
            StringBuilder sb = new StringBuilder(key);

            sb.Replace(@"HKEY_CLASSES_ROOT\", "");

            // Open HKCR\CLSID\{guid} for write access
            RegistryKey k = Registry.ClassesRoot.OpenSubKey(sb.ToString(), true);

            if (k == null)
            {
                return;
            }

            // Delete the 'Control' key, but don't throw an exception if it does not exist
            k.DeleteSubKey("Control", false);

            // Next open up InprocServer32
            RegistryKey inprocServer32 = k.OpenSubKey("InprocServer32", true);

            // And delete the CodeBase key, again not throwing if missing
            inprocServer32?.DeleteSubKey("CodeBase", false);
            inprocServer32?.Close();

            // Finally close the main key
            k.Close();
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 删除路径为keyPath的子项
        /// </summary>
        /// <param name="keyPath">The key path.</param>
        /// <returns></returns>
        public bool DeleteRegistryKeyPath(string keyPath)
        {
            bool result = false;

            try
            {
                _rootkey.DeleteSubKey(keyPath);
                result = true;
            }
            catch (SecurityException ex)
            {
                throw ex;
            }
            catch (ObjectDisposedException ex)
            {
                throw ex;
            }
            catch (UnauthorizedAccessException ex)
            {
                throw ex;
            }
            catch (IOException ex)
            {
                throw ex;
            }

            return(result);
        }
Ejemplo n.º 15
0
        public void SaveSettings()
        {
            RegistryKey rk        = Registry.CurrentUser.CreateSubKey(@"Software\SonicTeamJunior\Launcher");
            RegistryKey rkDisplay = rk.CreateSubKey("Display");
            RegistryKey rkMS      = rk.CreateSubKey("MasterServer");

            rkDisplay.SetValue("CustomResolution", boolDisplayCustomResolution);
            rkDisplay.SetValue("Windowed", boolDisplayWindowed);
            rkDisplay.SetValue("Height", intDisplayHeight);
            rkDisplay.SetValue("Width", intDisplayWidth);
            rkMS.SetValue("Port", intMSPort);
            rkMS.SetValue("Address", strMSAddress);
            rkMS.SetValue("ShowDefaultWads", boolShowDefaultWads);
            rk.SetValue("Params", strParams);
            rk.SetValue("CloseOnStart", boolCloseOnStart);

            rk.DeleteSubKey("Binaries", false);
            RegistryKey rkBinaries = rk.CreateSubKey("Binaries");

            rkBinaries.SetValue("2.0.4", Directory.GetCurrentDirectory() + "\\srb2win.exe");
            foreach (string strName in dicBinaries.Keys)
            {
                rkBinaries.SetValue(strName, dicBinaries[strName]);
            }

            rk.Close();
        }
Ejemplo n.º 16
0
        ///  <summary>
        ///  删除注册表项
        ///  虚方法,子类可进行重写
        ///  </summary>
        ///  <param name="subKey">注册表项名称</param>
        ///  <param name="regDomain">注册表基项域</param>
        ///  <returns>如果删除成功,则返回 true,否则为 false</returns>
        public virtual bool DeleteSubKey(string subKey, RegDomain regDomain)
        {
            ///返回删除是否成功
            bool result = false;

            ///判断注册表项名称是否为空,如果为空,返回 false
            if (subKey == string.Empty || subKey == null)
            {
                return(false);
            }

            ///创建基于注册表基项的节点
            RegistryKey key = GetRegDomain(regDomain);

            if (IsSubKeyExist(subKey, regDomain))
            {
                try
                {
                    ///删除注册表项
                    key.DeleteSubKey(subKey);
                    result = true;
                }
                catch
                {
                    result = false;
                }
            }
            ///关闭对注册表项的更改
            key.Close();
            return(result);
        }
Ejemplo n.º 17
0
        public static void RefreshSelAccs()
        //Удалить данные о ВЫБРАННЫХ АККАУНТАХ изи РЕЕСТРА
        {
            RegistryKey rk = null;

            try
            {
                rk = Registry.CurrentUser.CreateSubKey(RegParamData);
                if (rk == null)
                {
                    return;
                }
                try
                {
                    rk.DeleteSubKey("SelAccs");
                }
                catch
                {
                    rk.CreateSubKey("SelAccs");
                }
            }
            finally
            {
                rk?.Close();
            }
        }
Ejemplo n.º 18
0
        /* Methode zum Löschen eines Schlüssels in der Registry */
        public static void DeleteKey(RegistryRootKeys rootKey, string keyPath)
        {
            // Den Pfad zum übergeordneten Schlüssel und den Namen des zu löschenden
            // Schlüssels ermitteln
            int    i             = keyPath.LastIndexOf("\\");
            string parentKeyPath = keyPath.Substring(0, i);
            string keyName       = keyPath.Substring(i + 1, keyPath.Length - i - 1);

            // Den dem zu löschenden Schlüssel übergeordneten Schlüssel zum Schreiben
            // öffnen
            RegistryKey regKey = GetRegistryRootKey(rootKey).OpenSubKey(
                parentKeyPath, true);

            if (regKey != null)
            {
                // Schlüssel über den übergeordneten Schlüssel löschen
                regKey.DeleteSubKey(keyName);
            }
            else
            {
                // Schlüssel nicht gefunden: Ausnahme werfen
                throw new Exception("Schlüssel " + rootKey.ToString() + "\\" +
                                    keyPath + " nicht gefunden");
            }
        }
Ejemplo n.º 19
0
        private static void DeleteUserKey(Session session, string nameOfKey, string kkk)
        {
            session.Log($"  {nameof(DeleteUserKey)}({nameOfKey}, {kkk})");

            RegistryKey key = Registry.CurrentUser.OpenSubKey($"{nameOfKey}{kkk}", true);

            if (key != null)
            {
                try
                {
                    var values = key.GetValueNames();
                    foreach (string value in values)
                    {
                        session.Log($"Deleting Value '{value}'");
                        key.DeleteValue(value);
                    }

                    key = Registry.CurrentUser.OpenSubKey($"{nameOfKey}", true);
                    key?.DeleteSubKey(kkk);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }
        }
Ejemplo n.º 20
0
        public void Uninstall()
        {
            Console.WriteLine("Starting uninstall");
            OnStart?.Invoke();
            try {
                // Sneaky step: Remove URI handler.
                if (!string.IsNullOrEmpty(Info.ModURIProtocol) &&
                    !string.IsNullOrEmpty(Info.ModsDir))
                {
                    try {
                        RegistryKey regClasses = Registry
                                                 .CurrentUser
                                                 ?.OpenSubKey("Software", true)
                                                 ?.OpenSubKey("Classes", true);
                        regClasses?.DeleteSubKey(Info.ModURIProtocol, false);
                    } catch {
                    }
                }

                _Restore();
            } catch (Exception e) {
                Console.WriteLine(e);
                Console.WriteLine("Error! Please check installer-log.txt");
                OnError?.Invoke(e);
                if (Debugger.IsAttached)
                {
                    throw;
                }
                return;
            }
            Console.WriteLine("Finished uninstalling!");
            OnFinish?.Invoke();
        }
 /// <summary>
 /// 这将删除掉 (包括备份在内的) 所有的注册表键值!
 /// </summary>
 public void Delete()
 {
     if (!IsWritable)
     {
         throw ReadonlyException;
     }
     if (IsEnabled)
     {
         OpenCreateRegistry(SimsKeyPath);
         OpenCreateRegistry(EaKeyPath);
         RegistryKey key = OpenRegistry("Sims");
         key.DeleteSubKeyTree(Pack.RegName);
         if (key.SubKeyCount == 0)
         {
             key = SimsRoot;
             key.DeleteSubKey("Sims");
         }
         key = OpenRegistry(@"Electronic Arts\Sims");
         key.DeleteSubKeyTree(Pack.RegName);
         if (key.SubKeyCount == 0)
         {
             key = OpenRegistry(@"Electronic Arts");
             key.DeleteSubKey("Sims");
         }
     }
     else
     {
         OpenCreateRegistry(SimsBackupKeyPath);
         OpenCreateRegistry(EaBackupKeyPath);
         RegistryKey key = OpenRegistry("Sims" + BackupExtension);
         key.DeleteSubKeyTree(Pack.RegName);
         if (key.SubKeyCount == 0)
         {
             key = SimsRoot;
             key.DeleteSubKey("Sims" + BackupExtension);
         }
         key = OpenRegistry(@"Electronic Arts\Sims" + BackupExtension);
         key.DeleteSubKeyTree(Pack.RegName);
         if (key.SubKeyCount == 0)
         {
             key = OpenRegistry(@"Electronic Arts");
             key.DeleteSubKey("Sims" + BackupExtension);
         }
     }
     this._isInstalled = false;
     this.Save();
 }
Ejemplo n.º 22
0
        private static bool CheckAndRemoveKey(RegistryKey registryKey)
        {
            bool shouldRemoveKey = false;

            if (registryKey == null)
            {
                return(shouldRemoveKey);
            }

            Console.WriteLine("Checking RegistryKey: " + registryKey.Name);
            if (registryKey.SubKeyCount > 0)
            {
                string[] subKeyNames = new string[0];
                try
                {
                    subKeyNames = registryKey.GetSubKeyNames();
                }
                catch (IOException exception)
                {
                    Console.WriteLine(exception);
                }
                foreach (string subKeyName in subKeyNames)
                {
                    try
                    {
                        RegistryKey key = registryKey.OpenSubKey(subKeyName);
                        bool        shouldRemoveSubKey = CheckAndRemoveKey(key);
                        if (shouldRemoveSubKey)
                        {
                            registryKey.DeleteSubKey(subKeyName);
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                    }
                }
            }

            if (registryKey.ValueCount > 0)
            {
                string[] valueNames = registryKey.GetValueNames();
                foreach (string valueName in valueNames)
                {
                    object value = registryKey.GetValue(valueName);
                    if (value is string valueAsString)
                    {
                        if (ContainsPhrase(valueAsString))
                        {
                            Console.WriteLine("Removing value: " + valueAsString);
                            RemovedKeys.Add(valueAsString);
                            //registryKey.DeleteValue(valueAsString);
                            shouldRemoveKey = true;
                        }
                    }
                }
            }
            return(shouldRemoveKey);
        }
Ejemplo n.º 23
0
        private bool UnregisterComImportedType(Type type, string strAsmVersion)
        {
            bool   result = true;
            string text   = "{" + Marshal.GenerateGuidForType(type).ToString().ToUpper(CultureInfo.InvariantCulture) + "}";

            using (RegistryKey registryKey = Registry.ClassesRoot.OpenSubKey("CLSID", true))
            {
                if (registryKey != null)
                {
                    using (RegistryKey registryKey2 = registryKey.OpenSubKey(text, true))
                    {
                        if (registryKey2 != null)
                        {
                            using (RegistryKey registryKey3 = registryKey2.OpenSubKey("InprocServer32", true))
                            {
                                if (registryKey3 != null)
                                {
                                    registryKey3.DeleteValue("Assembly", false);
                                    registryKey3.DeleteValue("Class", false);
                                    registryKey3.DeleteValue("RuntimeVersion", false);
                                    registryKey3.DeleteValue("CodeBase", false);
                                    using (RegistryKey registryKey4 = registryKey3.OpenSubKey(strAsmVersion, true))
                                    {
                                        if (registryKey4 != null)
                                        {
                                            registryKey4.DeleteValue("Assembly", false);
                                            registryKey4.DeleteValue("Class", false);
                                            registryKey4.DeleteValue("RuntimeVersion", false);
                                            registryKey4.DeleteValue("CodeBase", false);
                                            if (registryKey4.SubKeyCount == 0 && registryKey4.ValueCount == 0)
                                            {
                                                registryKey3.DeleteSubKey(strAsmVersion);
                                            }
                                        }
                                    }
                                    if (registryKey3.SubKeyCount != 0)
                                    {
                                        result = false;
                                    }
                                    if (registryKey3.SubKeyCount == 0 && registryKey3.ValueCount == 0)
                                    {
                                        registryKey2.DeleteSubKey("InprocServer32");
                                    }
                                }
                            }
                            if (registryKey2.SubKeyCount == 0 && registryKey2.ValueCount == 0)
                            {
                                registryKey.DeleteSubKey(text);
                            }
                        }
                    }
                    if (registryKey.SubKeyCount == 0 && registryKey.ValueCount == 0)
                    {
                        Registry.ClassesRoot.DeleteSubKey("CLSID");
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 24
0
        public void deleteKey(string keypath)
        {
            string      rootkey = keypath.Split('\\')[0];
            RegistryKey OurKey  = detectRootkey(keypath);
            string      subkey  = keypath.Replace(rootkey + "\\", "");

            OurKey.DeleteSubKey(subkey);
        }
Ejemplo n.º 25
0
        public void Test01()
        {
            // [] Passing in null should throw ArgumentNullException
            _rk1 = Microsoft.Win32.Registry.CurrentUser;
            Action a = () => { _rk1.DeleteSubKey(null); };

            Assert.Throws <ArgumentNullException>(() => { a(); });
        }
Ejemplo n.º 26
0
 public static void DeleteSingleKey(string targetPath, string keyName) // Will delete key and content
 {
     using (var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
         using (RegistryKey registryKey = hklm.OpenSubKey(targetPath, true))
         {
             registryKey.DeleteSubKey(keyName);
         }
 }
Ejemplo n.º 27
0
 private void DeleteKey()
 {
     this.LogTaskMessage(string.Format(CultureInfo.CurrentCulture, "Deleting Registry Key: {0} in Hive: {1} on: {2}", this.Key, this.RegistryHive, this.MachineName));
     using (RegistryKey r = RegistryKey.OpenRemoteBaseKey(this.hive, this.MachineName))
     {
         r.DeleteSubKey(this.Key, false);
     }
 }
Ejemplo n.º 28
0
        public static void UnregisterBHO(Type type)
        {
            RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(BHO_REGISTRY_KEY_NAME, true);
            string guid = type.GUID.ToString("B");

            if (registryKey != null)
                registryKey.DeleteSubKey(guid, false);
        }
Ejemplo n.º 29
0
        public static void DeleteAdobeAdeptRegistryKey()
        {
            Console.WriteLine("Finding Adobe registry keys");

            Console.WriteLine(@"Finding HKEY_CURRENT_USER\Software\Adobe");

            if (Registry.CurrentUser.OpenSubKey("Software\\Adobe") == null)
            {
                Console.WriteLine("Cannot find Adobe registry key");

                return;
            }

            Console.WriteLine(@"Finding HKEY_CURRENT_USER\Software\Adobe\Adept");

            if (Registry.CurrentUser.OpenSubKey("Software\\Adobe\\Adept") == null)
            {
                Console.WriteLine("Cannot find Adobe Adept registry key");

                return;
            }

            Console.WriteLine(@"Finding HKEY_CURRENT_USER\Software\Adobe\Adept\Device");

            if (Registry.CurrentUser.OpenSubKey("Software\\Adobe\\Adept\\Device") == null)
            {
                Console.WriteLine("Cannot find Adobe Adept Device registry key");

                return;
            }

            RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\Adobe", true);

            if (registryKey != null)
            {
                Console.WriteLine(@"HKEY_CURRENT_USER\Software\Adobe\Adept\Device deleted");
                registryKey.DeleteSubKey("Adept\\Device");

                registryKey.DeleteSubKey("Adept");
                Console.WriteLine(@"HKEY_CURRENT_USER\Software\Adobe\Adept deleted");
            }
            else
            {
                Console.WriteLine("Cannot find Adobe Adept registry key");
            }
        }
Ejemplo n.º 30
0
    private void RemoveSavedLoginInformation()
    {
        RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);

        key.CreateSubKey("MixerInteractive");
        key = key.OpenSubKey("MixerInteractive", true);
        key.DeleteSubKey("Configuration");
    }