예제 #1
0
        /// <summary>
        /// Open and return the local machine's KWM configuration registry key.
        /// If the key does not exist, throw an exception.
        /// Caller must make sure to close the returned value after use.
        /// </summary>
        public static RegistryKey GetKwmLMRegKey()
        {
            RegistryKey key = Registry.LocalMachine.OpenSubKey(Base.GetKwmRegKeyString());

            if (key == null)
            {
                throw new Exception("Unable to read or create the registry key HKLM\\" + Base.GetKwmRegKeyString() + ".");
            }
            return(key);
        }
예제 #2
0
        /// <summary>
        /// Open and return the user's KWM configuration registry key,
        /// creating it if it does not already exist. Caller must make sure
        /// to close the returned value after use.
        /// </summary>
        public static RegistryKey GetKwmCURegKey()
        {
            RegistryKey regKey = Registry.CurrentUser.CreateSubKey(Base.GetKwmRegKeyString());

            if (regKey == null)
            {
                throw new Exception("Unable to read or create the registry key HKCU\\" + Base.GetKwmRegKeyString() + ".");
            }
            return(regKey);
        }