/// <summary>
 ///  The SamrSetInformationUser2 method updates attributes
 ///  on a user object. Opnum: 58 
 /// </summary>
 /// <param name="UserHandle">
 ///  An RPC context handle, as specified in section , representing
 ///  a user object.
 /// </param>
 /// <param name="UserInformationClass">
 ///  An enumeration indicating which attributes to update.
 ///  See section  for a listing of possible values.
 /// </param>
 /// <param name="Buffer">
 ///  The requested attributes and values to update. See section
 ///   for structure details.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrSetInformationUser2(System.IntPtr UserHandle,
     _USER_INFORMATION_CLASS UserInformationClass,
     //[Switch("UserInformationClass")]
     _SAMPR_USER_INFO_BUFFER Buffer)
 {
     return rpc.SamrSetInformationUser2(UserHandle, UserInformationClass, Buffer);
 }
 /// <summary>
 ///  The SamrQueryInformationUser method obtains attributes
 ///  from a user object. Opnum: 36 
 /// </summary>
 /// <param name="UserHandle">
 ///  UserHandle parameter.
 /// </param>
 /// <param name="UserInformationClass">
 ///  UserInformationClass parameter.
 /// </param>
 /// <param name="Buffer">
 ///  Buffer parameter.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrQueryInformationUser(System.IntPtr UserHandle,
     _USER_INFORMATION_CLASS UserInformationClass,
     //[Switch("UserInformationClass")]
     out _SAMPR_USER_INFO_BUFFER? Buffer)
 {
     return rpc.SamrQueryInformationUser(UserHandle, UserInformationClass, out Buffer);
 }
        /// <summary>
        ///  The SamrQueryInformationUser2 method obtains attributes
        ///  from a user object. Opnum: 47 
        /// </summary>
        /// <param name="UserHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a user object.
        /// </param>
        /// <param name="UserInformationClass">
        ///  An enumeration indicating which attributes to return.
        ///  See section  for a list of possible values.
        /// </param>
        /// <param name="Buffer">
        ///  The requested attributes on output. See section  for
        ///  structure details.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrQueryInformationUser2(
            IntPtr UserHandle,
            _USER_INFORMATION_CLASS UserInformationClass,
            out _SAMPR_USER_INFO_BUFFER? Buffer)
        {
            const ushort opnum = 47;
            Int3264[] paramList;
            int retVal = 0;

            paramList = new Int3264[] {
                UserHandle,
                (int)UserInformationClass,
                IntPtr.Zero,
                IntPtr.Zero
            };

            using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
            {
                Buffer = TypeMarshal.ToNullableStruct<_SAMPR_USER_INFO_BUFFER>(
                    Marshal.ReadIntPtr(outParamList[2]), UserInformationClass, null, null);
                retVal = outParamList[3].ToInt32();
            }

            return retVal;
        }
        /// <summary>
        ///  The SamrSetInformationUser2 method updates attributes
        ///  on a user object. Opnum: 58 
        /// </summary>
        /// <param name="UserHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a user object.
        /// </param>
        /// <param name="UserInformationClass">
        ///  An enumeration indicating which attributes to update.
        ///  See section  for a listing of possible values.
        /// </param>
        /// <param name="Buffer">
        ///  The requested attributes and values to update. See section
        ///   for structure details.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrSetInformationUser2(
            System.IntPtr UserHandle,
            _USER_INFORMATION_CLASS UserInformationClass,
            [Switch("UserInformationClass")] _SAMPR_USER_INFO_BUFFER Buffer)
        {
            const ushort opnum = 58;
            Int3264[] paramList;
            int retVal = 0;

            SafeIntPtr pBuffer = TypeMarshal.ToIntPtr(Buffer, UserInformationClass, null, null);

            paramList = new Int3264[] {
                UserHandle,
                (int)UserInformationClass,
                pBuffer,
                IntPtr.Zero
            };

            try
            {
                using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
                {
                    retVal = outParamList[3].ToInt32();
                }
            }
            finally
            {
                pBuffer.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))
     {
         UserHandle = inParams[0].ToIntPtr();
         UserInformationClass = (_USER_INFORMATION_CLASS)(inParams[1].ToInt32());
         Buffer = TypeMarshal.ToStruct<_SAMPR_USER_INFO_BUFFER>(inParams[2].ToIntPtr(), UserInformationClass, null, null);
     }
 }