/// <summary> /// When an RODC receives either the NetrServerAuthenticate3 method or the /// NetrLogonGetDomainInfo method with updates requested, it invokes this method /// on a normal (writable) DC to update to a client's computer account object in /// Active Directory. /// </summary> /// <param name="PrimaryName"> /// The custom RPC binding handle, as specified in section 3.5.5.1. /// </param> /// <param name="ChainedFromServerName"> /// The null-terminated Unicode string that contains the name of the read-only /// DC that issues the request. /// </param> /// <param name="ChainedForClientName"> /// The null-terminated Unicode string that contains the name of the client /// computer that called NetrServerAuthenticate3 or NetrLogonGetDomainInfo on /// the RODC. /// </param> /// <param name="Authenticator"> /// A pointer to a NETLOGON_AUTHENTICATOR structure that contains the client /// authenticator. /// </param> /// <param name="ReturnAuthenticator"> /// A pointer to a NETLOGON_AUTHENTICATOR structure that contains the server /// return authenticator. /// </param> /// <param name="dwInVersion"> /// One of the NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES union types selected based on /// the value of the pmsgIn field. The value MUST be 1. /// </param> /// <param name="pmsgIn"> /// A pointer to an NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES_V1 structure that contains /// the values to update on the client's computer account object in Active /// Directory on the normal (writable) DC. /// </param> /// <param name="pdwOutVersion"> /// A pointer to one of the NL_OUT_CHAIN_SET_CLIENT_ATTRIBUTES union types selected /// based on the value of the pmsgIn field. The value MUST be 1. /// </param> /// <param name="pmsgOut"> /// A pointer to an NL_OUT_CHAIN_SET_CLIENT_ATTRIBUTES_V1 structure that contains /// information on the client workstation and the writable domain controller. For /// how it is populated by the server, see below. /// </param> public NtStatus NetrChainSetClientAttributes( string PrimaryName, string ChainedFromServerName, string ChainedForClientName, _NETLOGON_AUTHENTICATOR? Authenticator, ref _NETLOGON_AUTHENTICATOR? ReturnAuthenticator, uint dwInVersion, NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES? pmsgIn, ref uint? pdwOutVersion, ref NL_OUT_CHAIN_SET_CLIENT_ATTRIBUTES? pmsgOut) { NtStatus status = rpc.NetrChainSetClientAttributes( PrimaryName, ChainedFromServerName, ChainedForClientName, Authenticator, ref ReturnAuthenticator, dwInVersion, pmsgIn, ref pdwOutVersion, ref pmsgOut); context.ConnectionStatus = status; return status; }
/// <summary> /// When an RODC receives either the NetrServerAuthenticate3 method or the /// NetrLogonGetDomainInfo method with updates requested, it invokes this method /// on a normal (writable) DC to update to a client's computer account object in /// Active Directory. /// </summary> /// <param name="PrimaryName"> /// The custom RPC binding handle, as specified in section 3.5.5.1. /// </param> /// <param name="ChainedFromServerName"> /// The null-terminated Unicode string that contains the name of the read-only /// DC that issues the request. /// </param> /// <param name="ChainedForClientName"> /// The null-terminated Unicode string that contains the name of the client /// computer that called NetrServerAuthenticate3 or NetrLogonGetDomainInfo on /// the RODC. /// </param> /// <param name="Authenticator"> /// A pointer to a NETLOGON_AUTHENTICATOR structure that contains the client /// authenticator. /// </param> /// <param name="ReturnAuthenticator"> /// A pointer to a NETLOGON_AUTHENTICATOR structure that contains the server /// return authenticator. /// </param> /// <param name="dwInVersion"> /// One of the NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES union types selected based on /// the value of the pmsgIn field. The value MUST be 1. /// </param> /// <param name="pmsgIn"> /// A pointer to an NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES_V1 structure that contains /// the values to update on the client's computer account object in Active /// Directory on the normal (writable) DC. /// </param> /// <param name="pdwOutVersion"> /// A pointer to one of the NL_OUT_CHAIN_SET_CLIENT_ATTRIBUTES union types selected /// based on the value of the pmsgIn field. The value MUST be 1. /// </param> /// <param name="pmsgOut"> /// A pointer to an NL_OUT_CHAIN_SET_CLIENT_ATTRIBUTES_V1 structure that contains /// information on the client workstation and the writable domain controller. For /// how it is populated by the server, see below. /// </param> public NtStatus NetrChainSetClientAttributes( string PrimaryName, string ChainedFromServerName, string ChainedForClientName, _NETLOGON_AUTHENTICATOR? Authenticator, ref _NETLOGON_AUTHENTICATOR? ReturnAuthenticator, uint dwInVersion, NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES? pmsgIn, ref uint? pdwOutVersion, ref NL_OUT_CHAIN_SET_CLIENT_ATTRIBUTES? pmsgOut) { const ushort opnum = 49; byte[] requestStub; byte[] responseStub; Int3264[] paramList; int retVal; SafeIntPtr pPrimaryName = Marshal.StringToHGlobalUni(PrimaryName); SafeIntPtr pChainedFromServerName = Marshal.StringToHGlobalUni(ChainedFromServerName); SafeIntPtr pChainedForClientName = Marshal.StringToHGlobalUni(ChainedForClientName); SafeIntPtr pAuthenticator = TypeMarshal.ToIntPtr(Authenticator); SafeIntPtr pReturnAuthenticatorIn = TypeMarshal.ToIntPtr(ReturnAuthenticator); SafeIntPtr ppMsgIn = TypeMarshal.ToIntPtr(pmsgIn, dwInVersion, null, null); SafeIntPtr ppdwOutVersion = TypeMarshal.ToIntPtr(pdwOutVersion); SafeIntPtr ppMsgOutIn = TypeMarshal.ToIntPtr(pmsgOut, pdwOutVersion.Value, null, null); paramList = new Int3264[] { pPrimaryName, pChainedFromServerName, pChainedForClientName, pAuthenticator, pReturnAuthenticatorIn, dwInVersion, ppMsgIn, ppdwOutVersion, ppMsgOutIn, 0 // retVal }; requestStub = RpceStubEncoder.ToBytes( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[opnum], true, paramList); rpceClientTransport.Call(opnum, requestStub, rpceTimeout, out responseStub); using (RpceInt3264Collection outParamList = RpceStubDecoder.ToParamList( RpceStubHelper.GetPlatform(), NrpcRpcStubFormatString.TypeFormatString, new RpceStubExprEval[] { new RpceStubExprEval(logon__NETLOGON_DELTA_USERExprEval_0000) }, NrpcRpcStubFormatString.ProcFormatString, NrpcRpcStubFormatString.ProcFormatStringOffsetTable[opnum], true, responseStub, paramList)) { IntPtr pReturnAuthenticatorOut = outParamList[4]; ReturnAuthenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(pReturnAuthenticatorOut); pdwOutVersion = TypeMarshal.ToNullableStruct<uint>(outParamList[7]); IntPtr ppMsgOutOut = outParamList[8]; pmsgOut = TypeMarshal.ToNullableStruct<NL_OUT_CHAIN_SET_CLIENT_ATTRIBUTES>( ppMsgOutOut, pdwOutVersion.Value, null, null); retVal = outParamList[9].ToInt32(); } pPrimaryName.Dispose(); pChainedFromServerName.Dispose(); pChainedForClientName.Dispose(); pAuthenticator.Dispose(); pReturnAuthenticatorIn.Dispose(); ppMsgIn.Dispose(); ppdwOutVersion.Dispose(); ppMsgOutIn.Dispose(); return (NtStatus)retVal; }
public NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES CreateNlInChainSetClientAttributes( string clientDnsHostName, OSVERSIONINFOEX? osVersionInfo, string osName) { NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES nlInChainSetClientAttributes = new NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES(); nlInChainSetClientAttributes.V1 = new _NL_IN_CHAIN_SET_CLIENT_ATTRIBUTES_V1(); nlInChainSetClientAttributes.V1.ClientDnsHostName = clientDnsHostName; nlInChainSetClientAttributes.V1.OsName = osName; if (osVersionInfo != null) { nlInChainSetClientAttributes.V1.OsVersionInfo = new _NL_OSVERSIONINFO_V1[1]; nlInChainSetClientAttributes.V1.OsVersionInfo[0].dwBuildNumber = osVersionInfo.Value.OSVersionInfo.dwBuildNumber; nlInChainSetClientAttributes.V1.OsVersionInfo[0].dwMajorVersion = (dwMajorVersion_Values)osVersionInfo.Value.OSVersionInfo.dwMajorVersion; nlInChainSetClientAttributes.V1.OsVersionInfo[0].dwMinorVersion = (dwMinorVersion_Values)osVersionInfo.Value.OSVersionInfo.dwMinorVersion; nlInChainSetClientAttributes.V1.OsVersionInfo[0].dwPlatformId = osVersionInfo.Value.OSVersionInfo.dwPlatformId; nlInChainSetClientAttributes.V1.OsVersionInfo[0].szCSDVersion = osVersionInfo.Value.OSVersionInfo.szCSDVersion; nlInChainSetClientAttributes.V1.OsVersionInfo[0].wProductType = (wProductType_Values)osVersionInfo.Value.wProductType; nlInChainSetClientAttributes.V1.OsVersionInfo[0].wReserved = 0; nlInChainSetClientAttributes.V1.OsVersionInfo[0].wServicePackMajor = osVersionInfo.Value.wServicePackMajor; nlInChainSetClientAttributes.V1.OsVersionInfo[0].wServicePackMinor = osVersionInfo.Value.wServicePackMinor; nlInChainSetClientAttributes.V1.OsVersionInfo[0].wSuiteMask = (wSuiteMask_Values)osVersionInfo.Value.wSuiteMask; nlInChainSetClientAttributes.V1.OsVersionInfo[0].dwOSVersionInfoSize = (uint)TypeMarshal.GetBlockMemorySize(nlInChainSetClientAttributes.V1.OsVersionInfo[0]); } return nlInChainSetClientAttributes; }