DsGetDomainControllerInfoA function

The DsGetDomainControllerInfo function retrieves data about the domain controllers in a domain.

Syntax

NTDSAPI DWORD DsGetDomainControllerInfoA(
  HANDLE hDs,
  LPCSTR DomainName,
  DWORD  InfoLevel,
  DWORD  *pcOut,
  VOID   **ppInfo
);

Parameters

hDs

Contains a directory service handle obtained from either the DSBind or DSBindWithCred function.

DomainName

Pointer to a null-terminated string that specifies the domain name.

InfoLevel

Contains a value that indicates the version of the DS_DOMAIN_CONTROLLER_INFO structure to return. This can be one of the following values.

1

The function provides the domain data in the DS_DOMAIN_CONTROLLER_INFO_1 structure format.

2

The function provides the domain data in the DS_DOMAIN_CONTROLLER_INFO_2 structure format.

3

The function provides the domain data in the DS_DOMAIN_CONTROLLER_INFO_3 structure format.

pcOut

Pointer to a DWORD variable that receives the number of items returned in ppInfo array.

ppInfo

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.

Return Value

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.

Requirements

   
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header ntdsapi.h
Library Ntdsapi.lib
DLL Ntdsapi.dll

See Also

DS_DOMAIN_CONTROLLER_INFO_1

DS_DOMAIN_CONTROLLER_INFO_2

DS_DOMAIN_CONTROLLER_INFO_3

Domain Controller and Replication Management Functions

DsBind

DsBindWithCred

DsFreeDomainControllerInfo