3.5.4.3.5 NetrGetAnyDCName (Opnum 13)
The NetrGetAnyDCName method MAY<162> be used to retrieve the name of a domain controller in the specified primary or directly trusted domain. Only DCs can return the name of a DC in a specified directly trusted domain.
-
NET_API_STATUS NetrGetAnyDCName( [in, unique, string] LOGONSRV_HANDLE ServerName, [in, unique, string] wchar_t* DomainName, [out, string] wchar_t** Buffer );
ServerName: The custom binding handle, as defined in section 3.5.4.1.
DomainName: A null-terminated Unicode string that contains the name of the primary or directly trusted domain. If the string is NULL or empty (that is, the first character in the string is the null-terminator character), the primary domain name is assumed.
Buffer: A pointer to an allocated buffer that contains the null-terminated Unicode string containing the NetBIOS name of a DC in the specified domain. The DC name is prefixed by two backslashes (\\).
Return Values: The method returns 0x00000000 on success; otherwise, it MUST return a nonzero error code and SHOULD return the following error code.
Return Value/Code |
Description |
---|---|
0x00000712 ERROR_DOMAIN_TRUST_INCONSISTENT |
The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain. |
The server MUST attempt to locate a DC for the domain specified by the client. The server SHOULD<163> implement alternate means to locate domain controllers: for example, a static list in a file, or the two methods detailed in [MS-ADTS] section 6.3.6. If the server that receives this call is the PDC for the domain specified in DomainName, the server MUST return ERROR_NO_SUCH_DOMAIN.
If the ServerName parameter is not a valid binding handle (as defined in section 3.5.4.1), the server MUST return ERROR_INVALID_COMPUTERNAME.
This method also returns errors based on Common Error Processing Rule E, specified in section 3.
NetrGetAnyDcName returns the name of the discovered DC.