Directory Services

DsListRoles

The DsListRoles function lists the roles that a server knows about.

DWORD DsListRoles(
  HANDLE hDs,
  PDS_NAME_RESULTW* ppRoles
);

Parameters

hDs
[in] Bind handle to the directory service.
ppRoles
[out] Pointer to a variable that receives a pointer to a DS_NAME_RESULT structure containing the roles the server knows about. The returned structure must be deallocated using DsFreeNameResult.

The indices of the array in the DS_NAME_RESULT structure indicate what data are contained by each array element. The following constants may be used to specify the desired index for a particular piece of information.

Value Meaning
DS_ROLE_DOMAIN_OWNER Server owns the domain.
DS_ROLE_INFRASTRUCTURE_OWNER Server owns the infrastructure.
DS_ROLE_PDC_OWNER Server owns the PDC.
DS_ROLE_RID_OWNER Server owns the RID.
DS_ROLE_SCHEMA_OWNER Server owns the schema.

Return Values

If the function returns a list of roles, the return value is NO_ERROR.

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

Individual name conversion errors are reported in the returned DS_NAME_RESULT structure.

Return Code Description
ERROR_INVALID_PARAMETER A parameter is incorrect.
ERROR_NOT_ENOUGH_MEMORY There is insufficient memory available.

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP.
Header: Declared in Ntdsapi.h.
Library: Use Ntdsapi.lib.

See Also

DsFreeNameResult, DS_NAME_RESULT, Domain Controller and Replication Management Functions