DsRoleGetPrimaryDomainInformation function (dsrole.h)

The DsRoleGetPrimaryDomainInformation function retrieves state data for the computer. This data includes the state of the directory service installation and domain data.


DWORD DsRoleGetPrimaryDomainInformation(
  [in]  LPCWSTR                          lpServer,
  [out] PBYTE                            *Buffer


[in] lpServer

Pointer to null-terminated Unicode string that contains the name of the computer on which to call the function. If this parameter is NULL, the local computer is used.

[in] InfoLevel

Contains one of the DSROLE_PRIMARY_DOMAIN_INFO_LEVEL values that specify the type of data to retrieve. This parameter also determines the format of the data supplied in Buffer.

[out] Buffer

Pointer to the address of a buffer that receives the requested data. The format of this data depends on the value of the InfoLevel parameter.

The caller must free this memory when it is no longer required by calling DsRoleFreeMemory.

Return value

If the function is successful, the return value is ERROR_SUCCESS.

If the function fails, the return value can be one of the following values.


Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header dsrole.h
Library Netapi32.lib
DLL Netapi32.dll

See also




Directory Service Functions