DeleteSubKey() public méthode

public DeleteSubKey ( string subkey ) : void
subkey string
Résultat void
Exemple #1
0
        public static void UnregisterFunction(Type t)
        {
            try
            {
                Microsoft.Win32.RegistryKey hklm = Microsoft.Win32.Registry.LocalMachine;
                Microsoft.Win32.RegistryKey hkcu = Microsoft.Win32.Registry.CurrentUser;

                string keyname = "SOFTWARE\\SolidWorks\\Addins\\{" + t.GUID.ToString() + "}";
                hklm.DeleteSubKey(keyname);
#if DEBUG
                keyname = "Software\\SolidWorks\\AddInsStartup\\{" + t.GUID.ToString() + "}";
                hkcu.DeleteSubKey(keyname);
#endif
            }
            catch (System.NullReferenceException nl)
            {
                Console.WriteLine("There was a problem unregistering this dll: " + nl.Message);
                System.Windows.Forms.MessageBox.Show("There was a problem unregistering this dll: \n\"" + nl.Message + "\"");
            }
            catch (System.Exception e)
            {
                Console.WriteLine("There was a problem unregistering this dll: " + e.Message);
                System.Windows.Forms.MessageBox.Show("There was a problem unregistering this dll: \n\"" + e.Message + "\"");
            }
        }
 public void Test01()
 {
     // [] Passing in null should throw ArgumentNullException
     _rk1 = Microsoft.Win32.Registry.CurrentUser;
     Action a = () => { _rk1.DeleteSubKey(null); };
     Assert.Throws<ArgumentNullException>(() => { a(); });
 }
        /// <summary>
        /// Copy all properties associated with a DataSourceName from local machine to local user
        /// </summary>
        /// <param name="p_strDsn"></param>
        public void CopyLocalMachineDsn(string p_strDsn)
        {
            //
            if (!this.LocalMachineDSNKeyExist(p_strDsn))
            {
                m_intError = -1;
                MessageBox.Show("Registry does not have a local machine ODBC.INI key for DSN name " + p_strDsn, "ODBCManager", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                return;
            }
            //delete the current user DSN subkey if it exists
            if (this.CurrentUserDSNKeyExist(p_strDsn))
            {
                m_oCurrentUserRegKey = Registry.CurrentUser.OpenSubKey(ODBC_INI_REG_PATH, true);
                m_oCurrentUserRegKey.DeleteSubKey(p_strDsn);
            }
            else
            {
                m_oCurrentUserRegKey = Registry.CurrentUser.OpenSubKey(ODBC_INI_REG_PATH, true);
            }
            m_oCurrentUserRegKey.CreateSubKey(p_strDsn);

            m_oLocalMachineRegKey = Registry.LocalMachine.OpenSubKey(ODBC_INI_REG_PATH + "\\" + p_strDsn, false);
            m_oCurrentUserRegKey  = Registry.CurrentUser.OpenSubKey(ODBC_INI_REG_PATH + "\\" + p_strDsn, true);
            string[] strValueNames = m_oLocalMachineRegKey.GetValueNames();
            foreach (string strValueName in strValueNames)
            {
                m_oCurrentUserRegKey.SetValue(strValueName, (string)m_oLocalMachineRegKey.GetValue(strValueName));
            }
            m_oLocalMachineRegKey.Close();
            m_oCurrentUserRegKey.Close();
        }
Exemple #4
0
 private void DeleteKey(RegistryKey rk, string p)
 {
     RegistryKey rkk =rk.OpenSubKey(p,true);
     string[] names = rkk.GetSubKeyNames();
     foreach (string s in names)
     {
         DeleteKey(rkk,s);
     }
     rk.DeleteSubKey(p);
 }
Exemple #5
0
 private void UnRegisterPlugin(string dname)
 {
     Microsoft.Win32.RegistryKey AcadPluginKey = GetAcadAppKey(true);
     if (AcadPluginKey != null)
     {
         AcadPluginKey.DeleteSubKey(AppName);
         AcadPluginKey.Close();
         AcadApp.ShowAlertDialog("注册表删除成功");
     }
     else
     {
         AcadApp.ShowAlertDialog("注册表删除失败");
     }
 }
Exemple #6
0
 private void UnRegisterPlugin(string dname)
 {
     Microsoft.Win32.RegistryKey AcadPluginKey = GetAcadAppKey(true);
     if (AcadPluginKey != null)
     {
         AcadPluginKey.DeleteSubKey(AppName);
         AcadPluginKey.Close();
         MessageBox.Show("软件卸载成功");
     }
     else
     {
         MessageBox.Show("软件卸载失败");
     }
 }
        public void Test03()
        {
            // [] Creating new SubKey and check that it exists
            _rk1 = Microsoft.Win32.Registry.CurrentUser;
            _rk1.CreateSubKey(_testKeyName);
            if (_rk1.OpenSubKey(_testKeyName) == null)
            {
                Assert.False(true, "Error SubKey does not exist.");
            }

            _rk1.DeleteSubKey(_testKeyName);
            if (_rk1.OpenSubKey(_testKeyName) != null)
            {
                Assert.False(true, "Error SubKey not removed properly");
            }
        }
Exemple #8
0
        /// <summary>
        /// 卸载时删除已注册的CAP文件
        /// 同时删除CAD 文件
        /// </summary>
        /// <param name="savedState"></param>
        public override void Uninstall(IDictionary savedState)
        {
            base.Uninstall(savedState);

            #region 卸载已注册的CAP文件
            RegistryKey capReg         = Registry.ClassesRoot.OpenSubKey(".cap");
            RegistryKey capFileTypeReg = Registry.ClassesRoot.OpenSubKey(".CA_FileType");

            if (capReg != null)
            {
                Registry.ClassesRoot.DeleteSubKeyTree(".cap");
            }
            if (capFileTypeReg != null)
            {
                Registry.ClassesRoot.DeleteSubKeyTree(".CA_FileType");
            }
            #endregion

            /// 重置AutoCAD菜单
            FileTypeRegister.ResetAutoCADMenu();

            #region  除Solidworks插件
            try
            {
                Microsoft.Win32.RegistryKey hklm = Microsoft.Win32.Registry.LocalMachine;
                Microsoft.Win32.RegistryKey hkcu = Microsoft.Win32.Registry.CurrentUser;

                string keyname = "SOFTWARE\\SolidWorks\\Addins\\{2eff6d31-932a-4191-ad00-1d705e27a64f}";
                hklm.DeleteSubKey(keyname);

                keyname = "Software\\SolidWorks\\AddInsStartup\\{2eff6d31-932a-4191-ad00-1d705e27a64f}";
                hkcu.DeleteSubKey(keyname);
            }
            catch (System.NullReferenceException nl)
            {
            }
            catch (System.Exception e)
            {
            }
            #endregion
        }
        public void Test02()
        {
            // [] Creating new SubKeys and get the names

            _rk1 = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(_testKeyName);
            _rk1.CreateSubKey(_testKeyName);
            if (_rk1.OpenSubKey(_testKeyName) == null)
            {
                Assert.False(true, "Error SubKey does not exist.");
            }
            _iCount = _rk1.SubKeyCount;
            _rk1.DeleteSubKey(_testKeyName);
            if (_rk1.SubKeyCount != _iCount - 1)
            {
                Assert.False(true, "Error expected==" + ((Int32)_iCount - 1).ToString() + ", got==" + _rk1.SubKeyCount);
            }
            if (_rk1.OpenSubKey(_testKeyName) != null)
            {
                Assert.False(true, "Error SubKey not removed properly");
            }
        }
        //Deletes a key. Or at least tries to.
        public void deleteKey(RegistryKey parentKey, string keytodelete)
        {
            log("Trying to delete key: " + parentKey.Name + ".");

            try
            {
                parentKey.DeleteSubKey(keytodelete);
                logsub("Success...");
            }
            catch (ObjectDisposedException w)
            {
                logsub("Key is closed so it can't be accessed.");
                throw (w);
            }
            catch (InvalidOperationException w)
            {
                logsub("The key cannot be deleted because it's not empty.");
                throw (w);
            }
            catch (ArgumentNullException w)
            {
                logsub("Key name is null.");
                throw (w);
            }
            catch (ArgumentException w)
            {
                logsub("Key name is too long.");
                throw (w);

            }
            catch (SecurityException w)
            {
                logsub("User has not enough privileges to access this key.");
                throw (w);
            }
        }
		/// <summary>
		/// Static function that clears out the contents of a key
		/// </summary>
		/// <param name="key">Key to be cleared</param>
		public static void ClearKey( RegistryKey key )
		{
			foreach( string name in key.GetValueNames() )
				key.DeleteValue( name );

			// TODO: This throws under Mono - Restore when bug is fixed
			//foreach( string name in key.GetSubKeyNames() )
			//    key.DeleteSubKeyTree( name );

			foreach (string name in key.GetSubKeyNames())
			{
				ClearSubKey(key, name);
				key.DeleteSubKey( name );
			}
		}
Exemple #12
0
 /// <summary>
 /// Delete key mới trong registry
 /// </summary>
 /// <param name="strPath">Đường dẫn chứa key</param>
 /// <param name="strKeyName">Tên key</param>
 public static void DeleteKey(RegistryKey regKey, string strPath, string strKeyName)
 {
     regKey = regKey.CreateSubKey(strPath);
     regKey.DeleteSubKey(strKeyName);
 }
 private void SaveGroupTreeView(RegistryKey rkUser) {
     QTUtility.GroupPathsDic.Clear();
     QTUtility.StartUpGroupList.Clear();
     QTUtility.dicGroupShortcutKeys.Clear();
     QTUtility.dicGroupNamesAndKeys.Clear();
     List<PluginKey> list = new List<PluginKey>();
     int num = 1;
     foreach(TreeNode node in tnGroupsRoot.Nodes) {
         MenuItemArguments tag = (MenuItemArguments)node.Tag;
         if(tag == MIA_GROUPSEP) {
             QTUtility.GroupPathsDic["Separator" + num++] = string.Empty;
         }
         else if(node.Nodes.Count > 0) {
             string text = node.Text;
             if(text.Length > 0) {
                 string str2 = node.Nodes.Cast<TreeNode>()
                         .Select(node2 => node2.Name)
                         .Where(name => name.Length > 0)
                         .StringJoin(";");
                 if(str2.Length > 0) {
                     string item = text.Replace(";", "_");
                     QTUtility.GroupPathsDic[item] = str2;
                     if(node.NodeFont == fntStartUpGroup) {
                         QTUtility.StartUpGroupList.Add(item);
                     }
                     if(tag.KeyShortcut != 0) {
                         if(tag.KeyShortcut > 0x100000) {
                             QTUtility.dicGroupShortcutKeys[tag.KeyShortcut] = item;
                         }
                         QTUtility.dicGroupNamesAndKeys[item] = tag.KeyShortcut;
                         list.Add(new PluginKey(item, new int[] { tag.KeyShortcut }));
                     }
                 }
             }
         }
     }
     rkUser.DeleteSubKey("Groups", false);
     using(RegistryKey key = rkUser.CreateSubKey("Groups")) {
         if(key != null) {
             foreach(string str4 in QTUtility.GroupPathsDic.Keys) {
                 key.SetValue(str4, QTUtility.GroupPathsDic[str4]);
             }
         }
     }
     rkUser.DeleteValue("ShortcutKeys_Group", false);
     if(list.Count > 0) {
         QTUtility2.WriteRegBinary(list.ToArray(), "ShortcutKeys_Group", rkUser);
     }
 }
Exemple #14
0
 public static void SaveCache(RegistryKey rkUser) {
     try {
         if(fCacheDirty && (rkUser != null)) {
             rkUser.DeleteSubKey("Cache", false);
             using(RegistryKey key = rkUser.CreateSubKey("Cache")) {
                 if(key != null) {
                     int num = dicCacheIDLs.Count - 0x30;
                     List<string> list = new List<string>();
                     if(num > 0) {
                         foreach(string str in dicCacheIDLs.Keys) {
                             if(num <= 0) {
                                 break;
                             }
                             byte[] buffer = dicCacheIDLs[str];
                             if(((buffer == null) || (buffer.Length == 0)) || (buffer[0] != 20)) {
                                 list.Add(str);
                                 num--;
                             }
                         }
                         foreach(string str2 in list) {
                             dicCacheIDLs.Remove(str2);
                         }
                         if(num > 0) {
                             list.Clear();
                             foreach(string str3 in dicCacheIDLs.Keys) {
                                 if(num <= 0) {
                                     break;
                                 }
                                 list.Add(str3);
                                 num--;
                             }
                             foreach(string str4 in list) {
                                 dicCacheIDLs.Remove(str4);
                             }
                         }
                     }
                     foreach(string str5 in dicCacheIDLs.Keys) {
                         key.SetValue(str5, dicCacheIDLs[str5]);
                     }
                 }
             }
         }
         fCacheDirty = false;
     }
     catch(Exception exception) {
         QTUtility2.MakeErrorLog(exception, null, false);
     }
 }
        public static int Win32DeleteSubKey(RegistryKey parentKey, string key)
        {
            int iRet = 0;

            try
            {
                parentKey.DeleteSubKey(key, true);
            }
            catch (Exception ex)
            {
                iRet = -1;
                Logger.LogException("Win32DeleteSubKeyValue : ", ex);
            }

            return iRet;
        }
Exemple #16
0
 private void DeleteSubkeysRecursively(RegistryKey regKey)
 {
     try
     {
         foreach (string subKeyName in regKey.GetSubKeyNames())
         {
             RegistryKey tmpKey = regKey.CreateSubKey(subKeyName, RegistryKeyPermissionCheck.ReadWriteSubTree);
             if (regKey.OpenSubKey(subKeyName).SubKeyCount == 0)
             {
                 foreach (string regValue in tmpKey.GetValueNames())
                 {
                     tmpKey.DeleteValue(regValue);
                 }
                 regKey.DeleteSubKey(subKeyName);
                 tmpKey.Close();
             }
             else
                 DeleteSubkeysRecursively(tmpKey);
         }
     }
     catch
     {
     }
 }
		public static bool DeleteKey (RegistryKey registryKey, string key)
		{
			if (registryKey == null)		throw new NolmeArgumentNullException ();

			bool bResult = false;

			if (registryKey != null)
			{
				registryKey.DeleteSubKey (key);
				bResult = !Win32RegistryUtility.IsExists (registryKey, key);
			}
			return bResult;
		}
        /// <summary>
        /// Save all the information in a class to the registry. This method iterates through
        /// all members of the specified class and saves them to the registry.
        /// </summary>
        /// <param name="settings">An object that holds all the desired settings</param>
        /// <param name="Key">The registry key in which to save data</param>
        public static void Save(object settings, RegistryKey Key)
        {
            RegistryKey subkey;

            // Iterate through each Field of the specified class using "Reflection".
            // The name of each Field is used to generate the name of the registry
            // value, sometimes with appended characters to specify elements of more
            // complex Field types such as a Font or a Point. Arrays are stored by
            // creating a new subkey with the same name as the Field. The subkey holds
            // values with names that are just the integers 0,1,2,... giving the index
            // of each value.
            //

            foreach(FieldInfo fi in settings.GetType().GetFields(
                BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
            {
                // If this field is an Enum it needs to be handled separately. The text
                // name for the enum is written to the registry.
                if(fi.FieldType.IsEnum)
                {
                    Key.SetValue(fi.Name,Enum.GetName(fi.FieldType,fi.GetValue(settings)));
                }

                // Otherwise each different field type is handled case by case using
                // a large switch statement
                else
                {
                    // Test the name of the Field type, converted to lower case
                    switch (fi.FieldType.Name.ToLower())
                    {
                        case "string":
                            Key.SetValue(fi.Name,(string)fi.GetValue(settings));
                            break;

                        case "boolean":
                            Key.SetValue(fi.Name,(bool)fi.GetValue(settings));
                            break;

                        case "int32":
                            Key.SetValue(fi.Name,(int)fi.GetValue(settings));
                            break;

                        case "decimal":
                            decimal TheDecimal=(decimal)fi.GetValue(settings);
                            Key.SetValue(fi.Name,(int)TheDecimal);
                            break;

                        case "single":
                            Key.SetValue(fi.Name,(float)fi.GetValue(settings));
                            break;

                        case "double":
                            Key.SetValue(fi.Name,(double)fi.GetValue(settings));
                            break;

                        // Store a Point as two separate integers
                        case "point":
                            Point point=(Point)fi.GetValue(settings);
                            Key.SetValue(fi.Name+".X",point.X);
                            Key.SetValue(fi.Name+".Y",point.Y);
                            break;

                        // Store a Size as two separate integers
                        case "size":
                            Size size=(Size)fi.GetValue(settings);
                            Key.SetValue(fi.Name+".Height",size.Height);
                            Key.SetValue(fi.Name+".Width",size.Width);
                            break;

                        // byte arrays are a native registry type and thus easy to handle
                        case "byte[]":
                            byte[] bytes = (byte[])fi.GetValue(settings);
                            if(bytes==null)break;
                            Key.SetValue(fi.Name,bytes);
                            break;

                        // string arrays are a native registry type and thus easy to handle
                        case "string[]":
                            string[] strings = (string[])fi.GetValue(settings);
                            if(strings==null)break;
                            Key.SetValue(fi.Name,strings);
                            break;

                        // For arrays that aren't native registry types, create a subkey and then
                        // create values that are numbered sequentially. First delete the subkey
                        // if it already exists then refill it with all the values of the array.
                        case "int32[]":
                            int[] numbers = (int[])fi.GetValue(settings);
                            if(numbers==null)break;
                            Key.DeleteSubKey(fi.Name,false);   // first delete all the old values
                            subkey=Key.CreateSubKey(fi.Name);
                            for(int i=0;i<numbers.Length;i++)
                            {
                                subkey.SetValue(i.ToString(),numbers[i]);
                            }
                            break;

                        case "boolean[]":
                            bool[] bools = (bool[])fi.GetValue(settings);
                            if(bools==null)break;
                            Key.DeleteSubKey(fi.Name,false);   // first delete all the old values
                            subkey=Key.CreateSubKey(fi.Name);
                            for(int i=0;i<bools.Length;i++)
                            {
                                subkey.SetValue(i.ToString(),bools[i]);
                            }
                            break;

                        case "single[]":
                            float[] floats = (float[])fi.GetValue(settings);
                            if(floats==null)break;
                            Key.DeleteSubKey(fi.Name,false);   // first delete all the old values
                            subkey=Key.CreateSubKey(fi.Name);
                            for(int i=0;i<floats.Length;i++)
                            {
                                subkey.SetValue(i.ToString(),floats[i]);
                            }
                            break;

                        case "double[]":
                            double[] doubles = (double[])fi.GetValue(settings);
                            if(doubles==null)break;
                            Key.DeleteSubKey(fi.Name,false);   // first delete all the old values
                            subkey=Key.CreateSubKey(fi.Name);
                            for(int i=0;i<doubles.Length;i++)
                            {
                                subkey.SetValue(i.ToString(),doubles[i]);
                            }
                            break;

                        // Saving colors is easy, unlike reading them, which is trickier. We just use the Color's
                        // Name property. If there is no known name, the Argb value will be written in hexadecimal.
                        case "color":
                            Key.SetValue(fi.Name,((Color)fi.GetValue(settings)).Name);
                            break;

                        // Save a TimeSpan using it's ToString() method
                        case "timespan":
                            Key.SetValue(fi.Name,((TimeSpan)fi.GetValue(settings)).ToString());
                            break;

                        // Save a DateTime using it's ToString() method
                        case "datetime":
                            Key.SetValue(fi.Name,((DateTime)fi.GetValue(settings)).ToString());
                            break;

                        // Save a Font by separately storing Name, Size, and Style
                        case "font":
                            Key.SetValue(fi.Name+".Name",((Font)fi.GetValue(settings)).Name);
                            Key.SetValue(fi.Name+".Size",((Font)fi.GetValue(settings)).Size);
                            Key.SetValue(fi.Name+".Style",((Font)fi.GetValue(settings)).Style);
                            break;

                        default:
                            MessageBox.Show("This Field type cannot be saved by the Savior class: "+fi.FieldType);
                            break;
                    }
                }
            }
        }
Exemple #19
0
 /// 删除路径为keypath的子项
 private bool DelRegSubKey(RegistryKey rootkey, string keypath)
 {
     try
     {
         rootkey.DeleteSubKey(keypath);
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #20
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Recursively delete a registry key
		/// </summary>
		/// <param name="key"></param>
		/// ------------------------------------------------------------------------------------
		private static void DeleteRegistryKey(RegistryKey key)
		{
			// find all the subkeys and delete them recursively.
			foreach (string subKeyName in key.GetSubKeyNames())
			{
				using (var regKey = key.OpenSubKey(subKeyName, true))
					DeleteRegistryKey(regKey);
				key.DeleteSubKey(subKeyName);
			}
		}
Exemple #21
0
        /// <summary>
        /// Static function that clears out the contents of a key
        /// </summary>
        /// <param name="key">Key to be cleared</param>
        public static void ClearKey( RegistryKey key )
        {
            foreach( string name in key.GetValueNames() )
                key.DeleteValue( name );

            // TODO: This throws under Mono - Restore when bug is fixed
            //foreach( string name in key.GetSubKeyNames() )
            //    key.DeleteSubKeyTree( name );

            foreach (string name in key.GetSubKeyNames())
            {
                ClearSubKey(key, name);
                // TODO: Remove this test when Mono bug is fixed
                if ( NUnit.Core.RuntimeFramework.CurrentFramework.Runtime == NUnit.Core.RuntimeType.Net )
                    key.DeleteSubKey( name );
            }
        }
Exemple #22
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Recursively delete a registry key
		/// </summary>
		/// <param name="key"></param>
		/// ------------------------------------------------------------------------------------
		private void DeleteRegistryKey(RegistryKey key)
		{
			// find all the subkeys and delete them recursively.
			foreach (string subKeyName in key.GetSubKeyNames())
			{
				DeleteRegistryKey(key.OpenSubKey(subKeyName, true));
				key.DeleteSubKey(subKeyName);
			}
		}
 private void DeleteConfigKey(RegistryKey parentKey, string subkeyname)
 {
     parentKey.DeleteSubKey(subkeyname, false);
 }
Exemple #24
0
 internal void Delete(RegistryKey settings)
 {
     if (settings.GetSubKeyNames().Contains(Alias))
         settings.DeleteSubKey(Alias);
 }
Exemple #25
0
		public static bool RegisterSingleFileGenerators(IMessageSink sink, Assembly assembly, RegistryKey rootKey, string generatorsKey, bool unregister = false)
		{
			bool ok = false;
			try {
				foreach (Type type in assembly.GetTypes())
				{
					var a = type.GetCustomAttributes(typeof(CodeGeneratorRegistrationAttribute), true);
					foreach (CodeGeneratorRegistrationAttribute attr in a) {
						string subKey = string.Format(@"{0}\{1}", attr.ContextGuid, attr.GeneratorType.Name);
						string path = Path.Combine(generatorsKey, subKey);
						if (unregister) {
							try {
								rootKey.DeleteSubKey(path, true);
								ok = true;
							} catch {}
						} else {
							try {
								using (RegistryKey key = rootKey.CreateSubKey(path))
								{
									if (key == null)
										sink.Write(Severity.Error, path, "Failed to create registry key");
									else {
										SetValue(key, "", attr.GeneratorName);
										SetValue(key, "CLSID", "{" + attr.GeneratorGuid.ToString() + "}");
										SetValue(key, "GeneratesDesignTimeSource", 1);
										ok = true;
									}
								}
							} catch (Exception ex) {
								sink.Write(Severity.Error, path, "{0}: {1}", ex.GetType().Name, ex.Message);
								return false;
							}
						}
					}
				}
			} catch (System.Reflection.ReflectionTypeLoadException ex) {
				// For unknown reasons this exception occurred outside VS... The Message
				// just says to look inside LoaderExceptions. So I am forced to do this:
				throw ex.LoaderExceptions[0];
			}
			return ok;
		}
        private bool DeleteEntryPointKeyFromCategory_Recursive(String GUID, RegistryKey key)
        {
            try
            {
                String[] CatKeySplit = key.Name.Split('\\');

                if (CatKeySplit[CatKeySplit.Length - 1].ToLower() == GUID.ToLower())
                {
                    //delete key
                    return true;
                }

                foreach (var subkeyStr in key.GetSubKeyNames())
                {
                    RegistryKey CategorySubKey;

                    try
                    {
                        CategorySubKey = key.OpenSubKey(subkeyStr, true);
                    }
                    catch (Exception ex)
                    {
                        Logger.ReportException("Could not open registry key " + subkeyStr + " for write access in DeleteEntryPointKeyFromCategory_Recursive. ", ex);
                        continue;//Move to next key
                    }

                    if (DeleteEntryPointKeyFromCategory_Recursive(GUID, CategorySubKey) == true)
                    {
                        key.DeleteSubKey(subkeyStr);
                    }
                }

                return false;
            }
            catch (Exception ex)
            {
                Logger.ReportException("Error deleting key in DeleteEntryPointKeyFromCategory_Recursive(). " + ex.Message , ex);
                throw new Exception("Error deleting key in DeleteEntryPointKeyFromCategory_Recursive() " + ex.Message + GUID);
            }
        }