Ejemplo n.º 1
0
 /// <summary>
 ///  The SamrSetInformationGroup method updates attributes
 ///  on a group object. Opnum: 21 
 /// </summary>
 /// <param name="GroupHandle">
 ///  An RPC context handle, as specified in section , representing
 ///  a group object.
 /// </param>
 /// <param name="GroupInformationClass">
 ///  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 SamrSetInformationGroup(System.IntPtr GroupHandle,
     _GROUP_INFORMATION_CLASS GroupInformationClass,
     //[Switch("GroupInformationClass")]
     _SAMPR_GROUP_INFO_BUFFER Buffer)
 {
     return rpc.SamrSetInformationGroup(GroupHandle, GroupInformationClass, Buffer);
 }
        /// <summary>
        ///  The SamrQueryInformationGroup method obtains attributes
        ///  from a group object. Opnum: 20 
        /// </summary>
        /// <param name="GroupHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a group object.
        /// </param>
        /// <param name="GroupInformationClass">
        ///  An enumeration indicating which attributes to return.
        ///  See section  for a listing 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 SamrQueryInformationGroup(
            IntPtr GroupHandle,
            _GROUP_INFORMATION_CLASS GroupInformationClass,
            out _SAMPR_GROUP_INFO_BUFFER? Buffer)
        {
            const ushort opnum = 20;
            Int3264[] paramList;
            int retVal = 0;

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

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

            return retVal;
        }
        /// <summary>
        ///  The SamrSetInformationGroup method updates attributes
        ///  on a group object. Opnum: 21 
        /// </summary>
        /// <param name="GroupHandle">
        ///  An RPC context handle, as specified in section , representing
        ///  a group object.
        /// </param>
        /// <param name="GroupInformationClass">
        ///  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 SamrSetInformationGroup(
            IntPtr GroupHandle,
            _GROUP_INFORMATION_CLASS GroupInformationClass,
            _SAMPR_GROUP_INFO_BUFFER Buffer)
        {
            const ushort opnum = 21;
            Int3264[] paramList;
            int retVal = 0;

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

            paramList = new Int3264[] {
                GroupHandle,
                (int)GroupInformationClass,
                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))
     {
         GroupHandle = inParams[0].ToIntPtr();
         GroupInformationClass = (_GROUP_INFORMATION_CLASS)inParams[1].ToInt32();
         Buffer = TypeMarshal.ToStruct<_SAMPR_GROUP_INFO_BUFFER>(
             inParams[2].ToIntPtr(),
             GroupInformationClass, null, null);
     }
 }