/// <summary> /// Converts a string to an _RPC_STRING /// </summary> /// <param name="input"> /// A string to be converted. /// If it's null, Length and maximumLength is 0, Buffer is NULL. /// </param> /// <returns>Converted _RPC_STRING</returns> public static _RPC_STRING ToRpcString(string input) { _RPC_STRING rpcString = new _RPC_STRING(); if (input == null) { rpcString.Length = 0; rpcString.MaximumLength = 0; rpcString.Buffer = null; } else { rpcString.Buffer = Encoding.ASCII.GetBytes(input); rpcString.Length = (ushort)rpcString.Buffer.Length; rpcString.MaximumLength = (ushort)(rpcString.Length + 1); } return rpcString; }
/// <summary> /// The SamrOemChangePasswordUser2 method changes a user's /// password. Opnum: 54 /// </summary> /// <param name="BindingHandle"> /// An RPC binding handle parameter as specified in [C706-Ch2Intro]. /// </param> /// <param name="ServerName"> /// A counted string, encoded in the OEM character set, /// containing the NETBIOS name of the server; this parameter /// MAY servers ignore the ServerName parameter. be ignored /// by the server. /// </param> /// <param name="UserName"> /// A counted string, encoded in the OEM character set, /// containing the name of the user whose password is to /// be changed; see message processing later in this section /// for details on how this value is used as a database /// key to locate the account that is the target of this /// password change operation. /// </param> /// <param name="NewPasswordEncryptedWithOldLm"> /// A clear text password encrypted according to the specification /// of SAMPR_ENCRYPTED_USER_PASSWORD, where the key is /// the LM hash of the existing password for the target /// user (as presented by the client). The clear text password /// MUST be encoded in an OEM code page character set (as /// opposed to UTF-16). /// </param> /// <param name="OldLmOwfPasswordEncryptedWithNewLm"> /// The LM hash of the target user's existing password (as /// presented by the client) encrypted according to the /// specification of ENCRYPTED_LM_OWF_PASSWORD, where the /// key is the LM hash of the clear text password obtained /// from decrypting NewPasswordEncryptedWithOldLm (see /// the preceding description for decryption details). /// </param> /// <returns> /// status of the function call, for example: 0 indicates STATUS_SUCCESS /// </returns> public int SamrOemChangePasswordUser2(System.IntPtr BindingHandle, _RPC_STRING ServerName, _RPC_STRING UserName, _SAMPR_ENCRYPTED_USER_PASSWORD NewPasswordEncryptedWithOldLm, _ENCRYPTED_LM_OWF_PASSWORD OldLmOwfPasswordEncryptedWithNewLm) { return rpc.SamrOemChangePasswordUser2(BindingHandle, ServerName, UserName, NewPasswordEncryptedWithOldLm, OldLmOwfPasswordEncryptedWithNewLm); }
/// <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)) { //BindingHandle = inParams[0].ToIntPtr(); ServerName = TypeMarshal.ToStruct<_RPC_STRING>(inParams[0]); UserName = TypeMarshal.ToStruct<_RPC_STRING>(inParams[1]); NewPasswordEncryptedWithOldLm = TypeMarshal.ToStruct<_SAMPR_ENCRYPTED_USER_PASSWORD>(inParams[2]); OldLmOwfPasswordEncryptedWithNewLm = TypeMarshal.ToStruct<_ENCRYPTED_LM_OWF_PASSWORD>(inParams[3]); } }