/// <summary> /// The NetrLogonDummyRoutine1 method is no longer supported. /// It serves as a placeholder in the IDL file for the /// RPC opnum value 21.The NetrLogonDummyRoutine1 method /// is deprecated by NetrLogonGetCapabilities. It serves /// as a placeholder in the IDL file for the RPC opnum value /// 21.Supported in windows_nt, windows_2000, windows_xp, /// windows_server_2003, windows_vista, windows_server_2008, /// windows_7, and windows_server_7. Opnum: 21 /// </summary> /// <param name="ServerName"> /// A LOGONSRV_HANDLE Unicode string handle of the server /// that is handling the request. /// </param> /// <param name="ComputerName"> /// A string that contains the name of the computer. /// </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="QueryLevel"> /// Specifies the level of information to return from the /// domain controller being queried. A value of 0x00000001 /// causes a NETLOGON_DOMAIN_INFO structure that contains /// information about the DC to be returned. /// </param> /// <param name="serverCapabilities"> /// A pointer to a 32-bit set of bit flags that identify /// the server's capabilities. /// </param> public NtStatus NetrLogonGetCapabilities( string ServerName, string ComputerName, _NETLOGON_AUTHENTICATOR? Authenticator, ref _NETLOGON_AUTHENTICATOR? ReturnAuthenticator, uint QueryLevel, out _NETLOGON_CAPABILITIES? serverCapabilities) { const ushort opnum = 21; byte[] requestStub; byte[] responseStub; Int3264[] paramList; int retVal; SafeIntPtr pServerName = Marshal.StringToHGlobalUni(ServerName); SafeIntPtr pComputerName = Marshal.StringToHGlobalUni(ComputerName); SafeIntPtr pAuthenticator = TypeMarshal.ToIntPtr(Authenticator); SafeIntPtr pReturnAuthenticatorIn = TypeMarshal.ToIntPtr(ReturnAuthenticator); paramList = new Int3264[] { pServerName, pComputerName, pAuthenticator, pReturnAuthenticatorIn, QueryLevel, 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 pReturnAuthenticatorOut = outParamList[3]; ReturnAuthenticator = TypeMarshal.ToNullableStruct<_NETLOGON_AUTHENTICATOR>(pReturnAuthenticatorOut); IntPtr pServerCapabilities = outParamList[5]; serverCapabilities = TypeMarshal.ToNullableStruct<_NETLOGON_CAPABILITIES>( pServerCapabilities, QueryLevel, null, null); retVal = outParamList[6].ToInt32(); } pServerName.Dispose(); pComputerName.Dispose(); pAuthenticator.Dispose(); pReturnAuthenticatorIn.Dispose(); return (NtStatus)retVal; }
/// <summary> /// The NetrLogonGetCapabilities method is used by clients /// to confirm the server capabilities after a secure channel /// has been established. Opnum: 21 /// </summary> /// <param name="serverName"> /// A LOGONSRV_HANDLE Unicode string handle of the server /// that is handling the request. /// </param> /// <param name="computerName"> /// A string that contains the name of the computer. /// </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="queryLevel"> /// Specifies the level of information to return from the /// domain controller being queried. A value of 0x00000001 /// causes a NETLOGON_DOMAIN_INFO structure that contains /// information about the DC to be returned. /// </param> /// <param name="serverCapabilities"> /// A pointer to a 32-bit set of bit flags that identify /// the server's capabilities. /// </param> /// <returns> /// The method returns 0x00000000 on success; /// otherwise, it returns a nonzero error code. /// </returns> public NtStatus NetrLogonGetCapabilities( string serverName, string computerName, _NETLOGON_AUTHENTICATOR? authenticator, ref _NETLOGON_AUTHENTICATOR? returnAuthenticator, uint queryLevel, out _NETLOGON_CAPABILITIES? serverCapabilities) { context.PrimaryName = serverName; context.ClientComputerName = computerName; NtStatus status = rpc.NetrLogonGetCapabilities( serverName, computerName, authenticator, ref returnAuthenticator, queryLevel, out serverCapabilities); //ConnectionStatus: A 4-byte value that contains the most recent //connection status return value (section 3.4.5.3.1) last returned //during secure channel establishment or by a method requiring //session key establishment (section 3.1.4.6). context.ConnectionStatus = status; if (status == NtStatus.STATUS_SUCCESS && queryLevel == 1 && serverCapabilities != null) { context.NegotiateFlags = (NrpcNegotiateFlags)serverCapabilities.Value.ServerCapabilities; } return status; }