コード例 #1
0
        /// <summary>
        ///  The SamrValidatePassword method validates an application
        ///  password against the locally stored policy. Opnum :
        ///  67 
        /// </summary>
        /// <param name="Handle">
        ///  An RPC binding handle parameter, as specified in [C706-Ch2Intro].
        /// </param>
        /// <param name="ValidationType">
        ///  The password policy validation requested.
        /// </param>
        /// <param name="InputArg">
        ///  The password-related material to validate.
        /// </param>
        /// <param name="OutputArg">
        ///  The result of the validation.
        /// </param>
        /// <returns>
        /// status of the function call, for example: 0 indicates STATUS_SUCCESS
        /// </returns>
        public int SamrValidatePassword(
            System.IntPtr Handle,
            _PASSWORD_POLICY_VALIDATION_TYPE ValidationType,
            _SAM_VALIDATE_INPUT_ARG InputArg,
            out _SAM_VALIDATE_OUTPUT_ARG? OutputArg)
        {
            const ushort opnum = 67;
            Int3264[] paramList;
            int retVal = 0;

            SafeIntPtr pInputArg = TypeMarshal.ToIntPtr(InputArg, ValidationType, null, null);

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

            try
            {
                using (RpceInt3264Collection outParamList = RpceCall(paramList, opnum))
                {
                    OutputArg = TypeMarshal.ToNullableStruct<_SAM_VALIDATE_OUTPUT_ARG>(
                        Marshal.ReadIntPtr(outParamList[2]), ValidationType, null, null);
                    retVal = outParamList[3].ToInt32();
                }
            }
            finally
            {
                pInputArg.Dispose();
            }

            return retVal;
        }
コード例 #2
0
 /// <summary>
 ///  The SamrValidatePassword method validates an application
 ///  password against the locally stored policy. Opnum :
 ///  67 
 /// </summary>
 /// <param name="Handle">
 ///  An RPC binding handle parameter, as specified in [C706-Ch2Intro].
 /// </param>
 /// <param name="ValidationType">
 ///  The password policy validation requested.
 /// </param>
 /// <param name="InputArg">
 ///  The password-related material to validate.
 /// </param>
 /// <param name="OutputArg">
 ///  The result of the validation.
 /// </param>
 /// <returns>
 /// status of the function call, for example: 0 indicates STATUS_SUCCESS
 /// </returns>
 public int SamrValidatePassword(System.IntPtr Handle,
     _PASSWORD_POLICY_VALIDATION_TYPE ValidationType,
     //[Switch("ValidationType")]
     _SAM_VALIDATE_INPUT_ARG InputArg,
     //[Switch("ValidationType")]
     out _SAM_VALIDATE_OUTPUT_ARG? OutputArg)
 {
     return rpc.SamrValidatePassword(Handle, ValidationType, InputArg, out OutputArg);
 }
 /// <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))
     {
         ValidationType = (_PASSWORD_POLICY_VALIDATION_TYPE)inParams[0].ToInt32();
         InputArg = TypeMarshal.ToStruct<_SAM_VALIDATE_INPUT_ARG>(inParams[1], ValidationType, null, null);
     }
 }