Esempio n. 1
0
        public static KeyHandle Create(
            KeyAccess access,
            string name,
            ObjectFlags objectFlags,
            KeyHandle rootDirectory,
            RegOptions createOptions,
            out KeyCreationDisposition creationDisposition
            )
        {
            NtStatus         status;
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                if ((status = Win32.NtCreateKey(
                         out handle,
                         access,
                         ref oa,
                         0,
                         IntPtr.Zero,
                         createOptions,
                         out creationDisposition
                         )) >= NtStatus.Error)
                {
                    Win32.ThrowLastError(status);
                }
            }
            finally
            {
                oa.Dispose();
            }

            return(new KeyHandle(handle, true));
        }
Esempio n. 2
0
        public static KeyHandle Create(
            KeyAccess access,
            string name,
            ObjectFlags objectFlags,
            KeyHandle rootDirectory,
            RegOptions createOptions
            )
        {
            KeyCreationDisposition creationDisposition;

            return(Create(access, name, objectFlags, rootDirectory, createOptions, out creationDisposition));
        }
Esempio n. 3
0
        public KeyHandle(string name, ObjectFlags objectFlags, KeyHandle rootDirectory, KeyAccess access)
        {
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                Win32.NtOpenKey(
                    out handle,
                    access,
                    ref oa
                    ).ThrowIf();
            }
            finally
            {
                oa.Dispose();
            }

            this.Handle = handle;
        }
Esempio n. 4
0
        public KeyHandle(string name, ObjectFlags objectFlags, KeyHandle rootDirectory, KeyAccess access)
        {
            NtStatus         status;
            ObjectAttributes oa = new ObjectAttributes(name, objectFlags, rootDirectory);
            IntPtr           handle;

            try
            {
                if ((status = Win32.NtOpenKey(
                         out handle,
                         access,
                         ref oa
                         )) >= NtStatus.Error)
                {
                    Win32.ThrowLastError(status);
                }
            }
            finally
            {
                oa.Dispose();
            }

            this.Handle = handle;
        }