/// <summary> /// The NetrLogonGetTimeServiceParentDomain methodSupported /// in windows_2000_server, windows_xp and windows_server_2003. /// returns the name of the parent domain of the current /// domain. The domain name returned by this method is /// suitable for passing into the NetrLogonGetTrustRid /// method and NetrLogonComputeClientDigest method. Opnum /// : 35 /// </summary> /// <param name="ServerName"> /// The custom RPC binding handle, as specified in section /// . /// </param> /// <param name="DomainName"> /// A pointer to the buffer that receives the null-terminated /// Unicode string that contains the name of the parent /// domain. If the DNSdomain name is available, it is returned /// through this parameter; otherwise, the NetBIOS domain /// name is returned. /// </param> /// <param name="PdcSameSite"> /// A pointer to the buffer that receives the value that /// indicates whether the PDC for the domainDomainName /// is in the same site as the server specified by ServerName. /// This value SHOULD The Netlogon client ignores this value /// if ServerName is not a domain controller. be ignored /// if ServerName is not a domain controller. /// </param> public NetApiStatus NetrLogonGetTimeServiceParentDomain( string ServerName, out string DomainName, out PdcSameSite_Values? PdcSameSite) { const ushort opnum = 35; byte[] requestStub; byte[] responseStub; Int3264[] paramList; int retVal; SafeIntPtr pServerName = Marshal.StringToHGlobalUni(ServerName); paramList = new Int3264[] { pServerName, IntPtr.Zero, IntPtr.Zero, 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 pDomainName = outParamList[1]; //wchar_t** DomainName pDomainName = Marshal.ReadIntPtr(pDomainName); DomainName = Marshal.PtrToStringUni(pDomainName); PdcSameSite = TypeMarshal.ToNullableStruct<PdcSameSite_Values>(outParamList[2]); retVal = outParamList[3].ToInt32(); } pServerName.Dispose(); return (NetApiStatus)retVal; }
/// <summary> /// The NetrLogonGetTimeServiceParentDomain methodSupported /// in windows_2000_server, windows_xp and windows_server_2003. /// returns the name of the parent domain of the current /// domain. The domain name returned by this method is /// suitable for passing into the NetrLogonGetTrustRid /// method and NetrLogonComputeClientDigest method. Opnum: 35 /// </summary> /// <param name="serverName"> /// The custom RPC binding handle. /// </param> /// <param name="domainName"> /// A pointer to the buffer that receives the null-terminated /// Unicode string that contains the name of the parent /// domain. If the DNSdomain name is available, it is returned /// through this parameter; otherwise, the NetBIOS domain /// name is returned. /// </param> /// <param name="pdcSameSite"> /// A pointer to the buffer that receives the value that /// indicates whether the PDC for the domainDomainName /// is in the same site as the server specified by ServerName. /// This value SHOULD The Netlogon client ignores this value /// if ServerName is not a domain controller. be ignored /// if ServerName is not a domain controller. /// </param> /// <returns> /// The method returns 0x00000000 on success; /// otherwise, it returns a nonzero error code. /// </returns> public NetApiStatus NetrLogonGetTimeServiceParentDomain( string serverName, out string domainName, out PdcSameSite_Values? pdcSameSite) { return rpc.NetrLogonGetTimeServiceParentDomain( serverName, out domainName, out pdcSameSite); }