RegDeleteKey() private method

private RegDeleteKey ( IntPtr keyHandle, string valueName ) : int
keyHandle System.IntPtr
valueName string
return int
コード例 #1
0
        public void DeleteKey(RegistryKey rkey, string keyName, bool shouldThrowWhenKeyMissing)
        {
            IntPtr handle = Win32RegistryApi.GetHandle(rkey);
            int    num    = Win32RegistryApi.RegDeleteKey(handle, keyName);

            if (num != 2)
            {
                if (num != 0)
                {
                    this.GenerateException(num);
                }
                return;
            }
            if (shouldThrowWhenKeyMissing)
            {
                throw new ArgumentException("key " + keyName);
            }
        }