/// <summary> /// Look up the NRPC session context using the session context of RPCE /// </summary> /// <param name="rpceSessionContext">The RPCE layer session context</param> /// <param name="sessionContext">The corresponding NRPC session context</param> /// <returns>Whether the rpce session is a new session</returns> internal bool LookupSessionContext(RpceServerSessionContext rpceSessionContext, out NrpcServerSessionContext sessionContext) { lock (lockObj) { if (sessionContextMap.ContainsKey(rpceSessionContext)) { sessionContext = sessionContextMap[rpceSessionContext]; return(false); } else { sessionContext = new NrpcServerSessionContext(); sessionContextMap[rpceSessionContext] = sessionContext; return(true); } } }
/// <summary> /// Look up the NRPC session context using the session context of RPCE /// </summary> /// <param name="rpceSessionContext">The RPCE layer session context</param> /// <param name="sessionContext">The corresponding NRPC session context</param> /// <returns>Whether the rpce session is a new session</returns> internal bool LookupSessionContext(RpceServerSessionContext rpceSessionContext, out NrpcServerSessionContext sessionContext) { lock (lockObj) { if (sessionContextMap.ContainsKey(rpceSessionContext)) { sessionContext = sessionContextMap[rpceSessionContext]; return false; } else { sessionContext = new NrpcServerSessionContext(); sessionContextMap[rpceSessionContext] = sessionContext; return true; } } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcDsrEnumerateDomainTrustsRequest request = sessionContext.LastRequestReceived as NrpcDsrEnumerateDomainTrustsRequest; if (request == null) { throw new InvalidOperationException( "The corresponding request isn't found, unable to create the response"); } SafeIntPtr pDomains = TypeMarshal.ToIntPtr(Domains); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, pDomains, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pDomains.Dispose(); } }
/// <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 abstract void Decode(NrpcServerSessionContext sessionContext, byte[] requestStub);
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { return; }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrServerTrustPasswordsGetRequest request = sessionContext.LastRequestReceived as NrpcNetrServerTrustPasswordsGetRequest; if (request == null) { throw new InvalidOperationException("The corresponding request isn't found, unable to create the response"); } SafeIntPtr pReturnAuthenticator = TypeMarshal.ToIntPtr(ReturnAuthenticator); SafeIntPtr pEncryptedNewOwfPassword = TypeMarshal.ToIntPtr(EncryptedNewOwfPassword); SafeIntPtr pEncryptedOldOwfPassword = TypeMarshal.ToIntPtr(EncryptedOldOwfPassword); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pReturnAuthenticator, pEncryptedNewOwfPassword, pEncryptedOldOwfPassword, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pReturnAuthenticator.Dispose(); pEncryptedNewOwfPassword.Dispose(); pEncryptedOldOwfPassword.Dispose(); } }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { PrimaryName = Marshal.PtrToStringUni(outParamList[0]); ComputerName = Marshal.PtrToStringUni(outParamList[1]); ClientChallenge = TypeMarshal.ToNullableStruct<_NETLOGON_CREDENTIAL>(outParamList[2]); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrServerAuthenticate3Request request = sessionContext.LastRequestReceived as NrpcNetrServerAuthenticate3Request; if (request == null) { throw new InvalidOperationException("The corresponding request isn't found, unable to create the response"); } SafeIntPtr pServerCredential = TypeMarshal.ToIntPtr(ServerCredential); SafeIntPtr pAccountRid = TypeMarshal.ToIntPtr(AccountRid); SafeIntPtr pNegotiateFlags = TypeMarshal.ToIntPtr(NegotiateFlags); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pServerCredential, pNegotiateFlags, pAccountRid, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pServerCredential.Dispose(); pAccountRid.Dispose(); pNegotiateFlags.Dispose(); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrLogonUasLogonRequest request = sessionContext.LastRequestReceived as NrpcNetrLogonUasLogonRequest; if (request == null) { throw new InvalidOperationException( "The corresponding request isn't found, unable to create the response"); } SafeIntPtr pValidationInformation = TypeMarshal.ToIntPtr(ValidationInformation); SafeIntPtr ppValidationInformation = TypeMarshal.ToIntPtr(pValidationInformation.Value); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, ppValidationInformation, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pValidationInformation.Dispose(); ppValidationInformation.Dispose(); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrGetForestTrustInformationRequest request = sessionContext.LastRequestReceived as NrpcNetrGetForestTrustInformationRequest; if (request == null) { throw new InvalidOperationException("The corresponding request isn't found, unable to create the response"); } SafeIntPtr pReturnAuthenticator = TypeMarshal.ToIntPtr(ReturnAuthenticator); SafeIntPtr pForestTrustInfo = TypeMarshal.ToIntPtr(ForestTrustInfo); SafeIntPtr ppForestTrustInfo = TypeMarshal.ToIntPtr(pForestTrustInfo.Value); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pReturnAuthenticator, IntPtr.Zero, ppForestTrustInfo, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pReturnAuthenticator.Dispose(); pForestTrustInfo.Dispose(); ppForestTrustInfo.Dispose(); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrGetDCNameRequest request = sessionContext.LastRequestReceived as NrpcNetrGetDCNameRequest; if (request == null) { throw new InvalidOperationException("The corresponding request isn't found, unable to create the response"); } SafeIntPtr pBuffer = Marshal.StringToHGlobalUni(Buffer); SafeIntPtr ppBuffer = TypeMarshal.ToIntPtr(pBuffer.Value); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, ppBuffer, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pBuffer.Dispose(); ppBuffer.Dispose(); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrDatabaseSyncRequest request = sessionContext.LastRequestReceived as NrpcNetrDatabaseSyncRequest; if (request == null) { throw new InvalidOperationException("The corresponding request isn't found, unable to create the response"); } SafeIntPtr pReturnAuthenticator = TypeMarshal.ToIntPtr(ReturnAuthenticator); SafeIntPtr pSyncContext = TypeMarshal.ToIntPtr(SyncContext); SafeIntPtr pDeltaArray = TypeMarshal.ToIntPtr(DeltaArray); SafeIntPtr ppDeltaArray = TypeMarshal.ToIntPtr(pDeltaArray.Value); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pReturnAuthenticator, IntPtr.Zero, pSyncContext, ppDeltaArray, IntPtr.Zero, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pReturnAuthenticator.Dispose(); pSyncContext.Dispose(); pDeltaArray.Dispose(); ppDeltaArray.Dispose(); } }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { PrimaryName = Marshal.PtrToStringUni(outParamList[0]); ComputerName = Marshal.PtrToStringUni(outParamList[1]); Authenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[2]); ReturnAuthenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[3]); DatabaseID = (DatabaseID_Values)outParamList[4].ToUInt32(); SyncContext = TypeMarshal.ToNullableStruct<uint>(outParamList[5]); PreferredMaximumLength = outParamList[7].ToUInt32(); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrChainSetClientAttributesRequest request = sessionContext.LastRequestReceived as NrpcNetrChainSetClientAttributesRequest; if (request == null) { throw new InvalidOperationException("The corresponding request isn't found, unable to create the response"); } SafeIntPtr pReturnAuthenticator = TypeMarshal.ToIntPtr(ReturnAuthenticator); SafeIntPtr pPdwOutVersion = TypeMarshal.ToIntPtr(PdwOutVersion); SafeIntPtr pPmsgOut = TypeMarshal.ToIntPtr(PmsgOut, PdwOutVersion, null, null); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pReturnAuthenticator, IntPtr.Zero, IntPtr.Zero, pPdwOutVersion, pPmsgOut, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pReturnAuthenticator.Dispose(); pPdwOutVersion.Dispose(); pPmsgOut.Dispose(); } }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { PrimaryName = Marshal.PtrToStringUni(outParamList[0]); ChainedFromServerName = Marshal.PtrToStringUni(outParamList[1]); ChainedForClientName = Marshal.PtrToStringUni(outParamList[2]); Authenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[3]); ReturnAuthenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[4]); dwInVersion = outParamList[5].ToUInt32(); pmsgIn = TypeMarshal.ToNullableStruct<NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES>(outParamList[6], dwInVersion, null, null); pdwOutVersion = TypeMarshal.ToNullableStruct<uint>(outParamList[7]); pmsgOut = TypeMarshal.ToNullableStruct<NL_OUT_CHAIN_SET_CLIENT_ATTRIBUTES>(outParamList[8], pdwOutVersion, null, null); } }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { PrimaryName = Marshal.PtrToStringUni(outParamList[0]); ComputerName = Marshal.PtrToStringUni(outParamList[1]); Authenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[2]); OpaqueBufferSize = outParamList[5].ToUInt32(); OpaqueBuffer = IntPtrUtility.PtrToArray<byte>(outParamList[4], OpaqueBufferSize); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrLogonComputeServerDigestRequest request = sessionContext.LastRequestReceived as NrpcNetrLogonComputeServerDigestRequest; if (request == null) { throw new InvalidOperationException("The corresponding request isn't found, unable to create the response"); } SafeIntPtr pNewMessageDigest = IntPtrUtility.ArrayToPtr<byte>(NewMessageDigest); SafeIntPtr pOldMessageDigest = IntPtrUtility.ArrayToPtr<byte>(OldMessageDigest); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pNewMessageDigest, pOldMessageDigest, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pNewMessageDigest.Dispose(); pOldMessageDigest.Dispose(); } }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { PrimaryName = Marshal.PtrToStringUni(outParamList[0]); AccountName = Marshal.PtrToStringUni(outParamList[1]); SecureChannelType = (_NETLOGON_SECURE_CHANNEL_TYPE)(outParamList[2].ToInt32()); ComputerName = Marshal.PtrToStringUni(outParamList[3]); ClientCredential = TypeMarshal.ToNullableStruct<_NETLOGON_CREDENTIAL>(outParamList[4]); NegotiateFlags = TypeMarshal.ToNullableStruct<uint>(outParamList[6]); } }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { ServerName = Marshal.PtrToStringUni(outParamList[0]); FunctionCode = (FunctionCode_Values)outParamList[1].ToUInt32(); QueryLevel = (QueryLevel_Values)outParamList[2].ToUInt32(); Data = TypeMarshal.ToNullableStruct<_NETLOGON_CONTROL_DATA_INFORMATION>(outParamList[3], FunctionCode, null, null); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcDsrDeregisterDnsHostRecordsRequest request = sessionContext.LastRequestReceived as NrpcDsrDeregisterDnsHostRecordsRequest; if (request == null) { throw new InvalidOperationException( "The corresponding request isn't found, unable to create the response"); } Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { ServerName = Marshal.PtrToStringUni(outParamList[0]); ComputerName = Marshal.PtrToStringUni(outParamList[1]); Authenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[2]); ReturnAuthenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[3]); Level = (Level_Values)outParamList[4].ToUInt32(); WkstaBuffer = TypeMarshal.ToNullableStruct<_NETLOGON_WORKSTATION_INFORMATION>(outParamList[5], Level, null, null); } }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { TrustedDcName = Marshal.PtrToStringUni(outParamList[0]); AccountName = Marshal.PtrToStringUni(outParamList[1]); SecureChannelType = (_NETLOGON_SECURE_CHANNEL_TYPE)outParamList[2].ToUInt32(); ComputerName = Marshal.PtrToStringUni(outParamList[3]); Authenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[4]); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrLogonGetDomainInfoRequest request = sessionContext.LastRequestReceived as NrpcNetrLogonGetDomainInfoRequest; if (request == null) { throw new InvalidOperationException("The corresponding request isn't found, unable to create the response"); } SafeIntPtr pReturnAuthenticator = TypeMarshal.ToIntPtr(ReturnAuthenticator); SafeIntPtr pDomBuffer = TypeMarshal.ToIntPtr(DomBuffer, request.Level, null, null); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pReturnAuthenticator, (uint)request.Level, IntPtr.Zero, pDomBuffer, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pReturnAuthenticator.Dispose(); pDomBuffer.Dispose(); } }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { ServerName = Marshal.PtrToStringUni(outParamList[0]); Flags = outParamList[1].ToUInt32(); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrLogonGetTimeServiceParentDomainRequest request = sessionContext.LastRequestReceived as NrpcNetrLogonGetTimeServiceParentDomainRequest; if (request == null) { throw new InvalidOperationException("The corresponding request isn't found, unable to create the response"); } SafeIntPtr pDomainName = Marshal.StringToHGlobalUni(DomainName); SafeIntPtr ppDomainName = TypeMarshal.ToIntPtr(pDomainName.Value); SafeIntPtr pPdcSameSite = TypeMarshal.ToIntPtr(PdcSameSite); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, ppDomainName, pPdcSameSite, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pDomainName.Dispose(); ppDomainName.Dispose(); pPdcSameSite.Dispose(); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { return null; }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { ComputerName = Marshal.PtrToStringUni(outParamList[0]); EntryCount = outParamList[1].ToUInt32(); IntPtr ppSocketAddresses = Marshal.AllocHGlobal(IntPtr.Size); Marshal.WriteIntPtr(ppSocketAddresses, outParamList[2]); SocketAddresses = TypeMarshal.ToArray<_NL_SOCKET_ADDRESS>(ppSocketAddresses, (int)EntryCount); Marshal.FreeHGlobal(ppSocketAddresses); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> internal abstract byte[] Encode(NrpcServerSessionContext sessionContext);
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { LogonServer = Marshal.PtrToStringUni(outParamList[0]); ComputerName = Marshal.PtrToStringUni(outParamList[1]); Authenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[2]); ReturnAuthenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(outParamList[3]); LogonLevel = (_NETLOGON_LOGON_INFO_CLASS)outParamList[4].ToInt32(); LogonInformation = TypeMarshal.ToNullableStruct<_NETLOGON_LEVEL>(outParamList[5], LogonLevel, null, null); ValidationLevel = (_NETLOGON_VALIDATION_INFO_CLASS)outParamList[6].ToInt32(); ExtraFlags = TypeMarshal.ToNullableStruct<uint>(outParamList[9]); } }
/// <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(NrpcServerSessionContext sessionContext, byte[] requestStub) { using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(NrpcRpcAdapter.logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[(int)Opnum], false, requestStub)) { ComputerName = Marshal.PtrToStringUni(outParamList[0]); AccountName = Marshal.PtrToStringUni(outParamList[1]); AllowableAccountControlBits = outParamList[2].ToUInt32(); DomainName = Marshal.PtrToStringUni(outParamList[3]); DomainGuid = TypeMarshal.ToNullableStruct<Guid>(outParamList[4]); SiteName = Marshal.PtrToStringUni(outParamList[5]); Flags = outParamList[6].ToUInt32(); } }
/// <summary> /// Encodes the response stub /// </summary> /// <param name="sessionContext">The session context of the response to send</param> /// <returns>The response stub</returns> /// <exception cref="InvalidOperationException"> /// Thrown when corresponding request isn't found /// </exception> internal override byte[] Encode(NrpcServerSessionContext sessionContext) { NrpcNetrLogonSamLogonWithFlagsRequest request = sessionContext.LastRequestReceived as NrpcNetrLogonSamLogonWithFlagsRequest; if (request == null) { throw new InvalidOperationException( "The corresponding request isn't found, unable to create the response"); } SafeIntPtr pReturnAuthenticator = TypeMarshal.ToIntPtr(ReturnAuthenticator); SafeIntPtr pValidationInformation = TypeMarshal.ToIntPtr(ValidationInformation, request.ValidationLevel, null, null); SafeIntPtr pAuthoritative = TypeMarshal.ToIntPtr(Authoritative); SafeIntPtr pExtraFlags = TypeMarshal.ToIntPtr(ExtraFlags); try { Int3264[] paramList = new Int3264[] { IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, pReturnAuthenticator, IntPtr.Zero, IntPtr.Zero, (uint)request.ValidationLevel, pValidationInformation, pAuthoritative, pExtraFlags, (uint)Status }; return NrpcStubEncodeToBytes(paramList, Opnum); } finally { pReturnAuthenticator.Dispose(); pValidationInformation.Dispose(); pAuthoritative.Dispose(); pExtraFlags.Dispose(); } }