/// <summary>
 ///  The SamrAddMultipleMembersToAlias method adds multiple
 ///  members to an alias. Opnum: 52 
 /// </summary>
 /// <param name="AliasHandle">
 ///  An RPC context handle, as specified in section , representing
 ///  an alias object.
 /// </param>
 /// <param name="MembersBuffer">
 ///  A structure containing a list of SIDs to add as members
 ///  to the alias.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrAddMultipleMembersToAlias(System.IntPtr AliasHandle, _SAMPR_PSID_ARRAY? MembersBuffer)
 {
     return rpc.SamrAddMultipleMembersToAlias(AliasHandle, MembersBuffer);
 }
 /// <summary>
 ///  The SamrGetAliasMembership method obtains the union
 ///  of all aliases that a given set of SIDs is a member
 ///  of. Opnum: 16 
 /// </summary>
 /// <param name="DomainHandle">
 ///  An RPC context handle, as specified in section , representing
 ///  a domain object.
 /// </param>
 /// <param name="SidArray">
 ///  A list of SIDs.
 /// </param>
 /// <param name="Membership">
 ///  The union of all aliases (represented by RIDs) that
 ///  all SIDs in SidArray are a member of.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrGetAliasMembership(System.IntPtr DomainHandle,
     _SAMPR_PSID_ARRAY SidArray,
     out _SAMPR_ULONG_ARRAY Membership)
 {
     return rpc.SamrGetAliasMembership(DomainHandle, SidArray, out Membership);
 }
 /// <summary>
 ///  The SamrGetMembersInAlias method obtains the membership
 ///  list of an alias. Opnum: 33 
 /// </summary>
 /// <param name="AliasHandle">
 ///  An RPC context handle, as specified in section , representing
 ///  an alias object.
 /// </param>
 /// <param name="Members">
 ///  A structure containing an array of SIDs that represent
 ///  the membership list of the alias referenced by AliasHandle.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrGetMembersInAlias(System.IntPtr AliasHandle, out _SAMPR_PSID_ARRAY Members)
 {
     return rpc.SamrGetMembersInAlias(AliasHandle, out Members);
 }
        /// <summary>
        ///  The SamrAddMultipleMembersToAlias method adds multiple
        ///  members to an alias. Opnum: 52 
        /// </summary>
        /// <param name="AliasHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  an alias object.
        /// </param>
        /// <param name="MembersBuffer">
        ///  A structure containing a list of SIDs to add as members
        ///  to the alias.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrAddMultipleMembersToAlias(IntPtr AliasHandle, _SAMPR_PSID_ARRAY? MembersBuffer)
        {
            const ushort opnum = 52;
            Int3264[] paramList;
            int retVal = 0;
            SafeIntPtr pMembersBuffer = TypeMarshal.ToIntPtr(MembersBuffer);

            paramList = new Int3264[] {
                AliasHandle,
                pMembersBuffer,
                IntPtr.Zero
            };

            try
            {
                using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
                {
                    retVal = outParamList[2].ToInt32();
                }
            }
            finally
            {
                pMembersBuffer.Dispose();
            }

            return retVal;
        }
        /// <summary>
        ///  The SamrGetMembersInAlias method obtains the membership
        ///  list of an alias. Opnum: 33 
        /// </summary>
        /// <param name="AliasHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  an alias object.
        /// </param>
        /// <param name="Members">
        ///  A structure containing an array of SIDs that represent
        ///  the membership list of the alias referenced by AliasHandle.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrGetMembersInAlias(IntPtr AliasHandle, out _SAMPR_PSID_ARRAY Members)
        {
            const ushort opnum = 33;
            Int3264[] paramList;
            int retVal = 0;

            paramList = new Int3264[] {
                AliasHandle,
                IntPtr.Zero,
                IntPtr.Zero
            };

            using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
            {
                Members = TypeMarshal.ToStruct<_SAMPR_PSID_ARRAY>(outParamList[1]);
                retVal = outParamList[2].ToInt32();
            }

            return retVal;
        }
        /// <summary>
        ///  The SamrGetAliasMembership method obtains the union
        ///  of all aliases that a given set of SIDs is a member
        ///  of. Opnum: 16 
        /// </summary>
        /// <param name="DomainHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a domain object.
        /// </param>
        /// <param name="SidArray">
        ///  A list of SIDs.
        /// </param>
        /// <param name="Membership">
        ///  The union of all aliases (represented by RIDs) that
        ///  all SIDs in SidArray are a member of.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrGetAliasMembership(
            IntPtr DomainHandle,
            _SAMPR_PSID_ARRAY SidArray,
            out _SAMPR_ULONG_ARRAY Membership)
        {
            const ushort opnum = 16;
            Int3264[] paramList;
            int retVal = 0;

            SafeIntPtr pSidArray = TypeMarshal.ToIntPtr(SidArray);

            paramList = new Int3264[] {
                DomainHandle,
                pSidArray,
                IntPtr.Zero,
                IntPtr.Zero
            };

            try
            {
                using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
                {
                    Membership = TypeMarshal.ToStruct<_SAMPR_ULONG_ARRAY>(outParamList[2]);
                    retVal = outParamList[3].ToInt32();
                }
            }
            finally
            {
                pSidArray.Dispose();
            }

            return retVal;
        }
 /// <summary>
 ///  Decodes the request stub, and fills the fields of the class
 /// </summary>
 /// <param name="sessionContext">The session context of the request received</param>
 /// <param name="requestStub">The request stub got from RPCE layer</param>
 internal override void Decode(SamrServerSessionContext sessionContext, byte[] requestStub)
 {
     using (RpceInt3264Collection inParams = RpceStubDecoder.ToParamList(
    RpceStubHelper.GetPlatform(),
     SamrRpcStubFormatString.TypeFormatString,
     new RpceStubExprEval[]{
         new RpceStubExprEval(SamrRpcAdapter.samr_SAMPR_USER_LOGON_INFORMATIONExprEval_0000),
         new RpceStubExprEval(SamrRpcAdapter.samr_SAMPR_USER_LOGON_HOURS_INFORMATIONExprEval_0001),
         new RpceStubExprEval(SamrRpcAdapter.samr_SAMPR_USER_ACCOUNT_INFORMATIONExprEval_0002),
         new RpceStubExprEval(SamrRpcAdapter.samr_SAMPR_LOGON_HOURSExprEval_0003)},
     SamrRpcStubFormatString.ProcFormatString,
     SamrRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum],
     false,
     requestStub))
     {
         DomainHandle = inParams[0].ToIntPtr();
         SidArray = TypeMarshal.ToStruct<_SAMPR_PSID_ARRAY>(inParams[1].ToIntPtr());
     }
 }