/// <summary>
        /// Opens a SAM account.
        /// </summary>
        /// <param name="serverHandle">A handle to a SAM server.</param>
        /// <param name="domainId">The SID of the domain to open.</param>
        /// <param name="access">The desired access to the domain.</param>
        public SamDomainHandle(SamServerHandle serverHandle, Sid domainId, SamDomainAccess access)
        {
            IntPtr handle;

            Win32.SamOpenDomain(
                serverHandle,
                access,
                domainId,
                out handle
                ).ThrowIf();

            this.Handle = handle;
        }
Пример #2
0
        /// <summary>
        /// Opens a SAM account.
        /// </summary>
        /// <param name="serverHandle">A handle to a SAM server.</param>
        /// <param name="domainId">The SID of the domain to open.</param>
        /// <param name="access">The desired access to the domain.</param>
        public SamDomainHandle(SamServerHandle serverHandle, Sid domainId, SamDomainAccess access)
        {
            NtStatus status;
            IntPtr   handle;

            if ((status = Win32.SamOpenDomain(
                     serverHandle,
                     access,
                     domainId,
                     out handle
                     )) >= NtStatus.Error)
            {
                Win32.Throw(status);
            }

            this.Handle = handle;
        }
 /// <summary>
 /// Opens a SAM account.
 /// </summary>
 /// <param name="serverHandle">A handle to a SAM server.</param>
 /// <param name="name">The name of the domain to open.</param>
 /// <param name="access">The desired access to the domain.</param>
 public SamDomainHandle(SamServerHandle serverHandle, string name, SamDomainAccess access)
     : this(serverHandle, serverHandle.LookupDomain(name), access)
 {
 }