DsGetDomainControllerInfoA function (ntdsapi.h)

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

Syntax

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

Parameters

[in] hDs

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

[in] DomainName

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

[in] 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.

[out] pcOut

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

[out] 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.

Remarks

Note

The ntdsapi.h header defines DsGetDomainControllerInfo as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
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