/// <summary>
        ///  The SamrSetSecurityObject method sets the access control
        ///  on a server, domain, user, group, or alias object.
        ///  Opnum: 2 
        /// </summary>
        /// <param name="ObjectHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a server, domain, user, group, or alias object.
        /// </param>
        /// <param name="SecurityInformation">
        ///  A bit field that indicates the fields of SecurityDescriptor
        ///  that are requested to be set. The SECURITY_INFORMATION
        ///  type is defined in [MS-DTYP] section. The following
        ///  bits are valid; all other bits MUST be zero on send
        ///  and ignored on receipt.
        /// </param>
        /// <param name="SecurityDescriptor">
        ///  A security descriptor expressing access that is specific
        ///  to the ObjectHandle.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrSetSecurityObject(
            IntPtr ObjectHandle,
            SecurityInformation_Values SecurityInformation,
            _SAMPR_SR_SECURITY_DESCRIPTOR? SecurityDescriptor)
        {
            const ushort opnum = 2;
            Int3264[] paramList;
            int retVal = 0;

            SafeIntPtr pSecurityDescriptor = TypeMarshal.ToIntPtr(SecurityDescriptor);

            paramList = new Int3264[] {
                ObjectHandle,
                (uint)SecurityInformation,
                pSecurityDescriptor,
                IntPtr.Zero
            };

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

            return retVal;
        }
 /// <summary>
 ///  The SamrSetSecurityObject method sets the access control
 ///  on a server, domain, user, group, or alias object.
 ///  Opnum: 2 
 /// </summary>
 /// <param name="ObjectHandle">
 ///  An RPC context handle, as specified in section , representing
 ///  a server, domain, user, group, or alias object.
 /// </param>
 /// <param name="SecurityInformation">
 ///  A bit field that indicates the fields of SecurityDescriptor
 ///  that are requested to be set. The SECURITY_INFORMATION
 ///  type is defined in [MS-DTYP] section. The following
 ///  bits are valid; all other bits MUST be zero on send
 ///  and ignored on receipt.
 /// </param>
 /// <param name="SecurityDescriptor">
 ///  A security descriptor expressing access that is specific
 ///  to the ObjectHandle.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrSetSecurityObject(System.IntPtr ObjectHandle,
     SecurityInformation_Values SecurityInformation,
     _SAMPR_SR_SECURITY_DESCRIPTOR? SecurityDescriptor)
 {
     return rpc.SamrSetSecurityObject(ObjectHandle,
                 SecurityInformation,
                 SecurityDescriptor);
 }
 /// <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))
     {
         ObjectHandle = inParams[0].ToIntPtr();
         SecurityInformation = (SecurityInformation_Values)inParams[1].ToUInt32();
         SecurityDescriptor = TypeMarshal.ToNullableStruct<_SAMPR_SR_SECURITY_DESCRIPTOR>(inParams[2]);
     }
 }