The DsGetDomainControllerInfo function retrieves data about the domain controllers in a domain.
DWORD DsGetDomainControllerInfo( __in HANDLE hDs, __in LPTSTR DomainName, __in DWORD InfoLevel, __out DWORD *pcOut, __out VOID **ppInfo );
Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.
Pointer to a null-terminated string that specifies the domain name.
Contains a value that indicates the version of the DS_DOMAIN_CONTROLLER_INFO structure to return. This can be one of the following values.
The function provides the domain data in the DS_DOMAIN_CONTROLLER_INFO_1 structure format.
The function provides the domain data in the DS_DOMAIN_CONTROLLER_INFO_2 structure format.
The function provides the domain data in the DS_DOMAIN_CONTROLLER_INFO_3 structure format.
Pointer to a DWORD variable that receives the number of items returned in ppInfo array.
Pointer to a pointer variable that receives an array of DS_DOMAIN_CONTROLLER_INFO_* structures. The type of structures in this array is defined by the InfoLevel parameter. The caller must free this array, when it is no longer required, by using the DsFreeDomainControllerInfo function.
If the function returns domain controller data, the return value is ERROR_SUCCESS. If the caller does not have the privileges to access the server objects, the return value is ERROR_SUCCESS, but the DS_DOMAIN_CONTROLLER_INFO structures could be empty.
If the function fails, the return value can be one of the following error codes.
The version of the DS_DOMAIN_CONTROLLER_INFO structure returned by the domain controller did not match the version requested in InfoLevel.
DomainName is not NULL and contains an invalid domain name.
One or more parameters are invalid.
The requested version of the directory service server extensions is not supported.
Send comments about this topic to Microsoft
Build date: 11/12/2009