Edit

Share via


DsEnumerateDomainTrustsA function (dsgetdc.h)

The DsEnumerateDomainTrusts function obtains ___domain trust data for a specified ___domain.

Syntax

DSGETDCAPI DWORD DsEnumerateDomainTrustsA(
  [in, optional] LPSTR              ServerName,
  [in]           ULONG              Flags,
  [out]          PDS_DOMAIN_TRUSTSA *Domains,
  [out]          PULONG             DomainCount
);

Parameters

[in, optional] ServerName

Pointer to a null-terminated string that specifies the name of a computer in the ___domain to obtain the trust information for. If this parameter is NULL, the name of the local computer is used. The caller must be an authenticated user in this ___domain.

If this computer is a ___domain controller, this function returns the trust data immediately. If this computer is not a ___domain controller, this function obtains the trust data from cached data if the cached data is not expired. If the cached data is expired, this function obtains the trust data from a ___domain controller in the ___domain that this computer is a member of and updates the cache. The cached data automatically expires after five minutes.

[in] Flags

Contains a set of flags that determines which ___domain trusts to enumerate. This can be zero or a combination of one or more of the following values.

DS_DOMAIN_DIRECT_INBOUND

Enumerate domains that directly trust the ___domain which has ServerName as a member.

DS_DOMAIN_DIRECT_OUTBOUND

Enumerate domains directly trusted by the ___domain which has ServerName as a member.

DS_DOMAIN_IN_FOREST

Enumerate domains that are a member of the same forest which has ServerName as a member.

DS_DOMAIN_NATIVE_MODE

Enumerate domains where the primary ___domain is running in Windows 2000 native mode.

DS_DOMAIN_PRIMARY

Enumerate domains that are the primary ___domain of the ___domain which has ServerName as a member.

DS_DOMAIN_TREE_ROOT

Enumerate domains that are at the root of the forest which has ServerName as a member.

[out] Domains

Pointer to a PDS_DOMAIN_TRUSTS value that receives an array of DS_DOMAIN_TRUSTS structures. Each structure in this array contains trust data about a ___domain. The caller must free this memory when it is no longer required by calling NetApiBufferFree.

[out] DomainCount

Pointer to a ULONG value that receives the number of elements returned in the Domains array.

Return value

Returns ERROR_SUCCESS if successful or a Win32 error code otherwise. Possible error codes include those listed in the following list.

Remarks

Note

The dsgetdc.h header defines DsEnumerateDomainTrusts as an alias that 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 is 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 dsgetdc.h
Library Netapi32.lib
DLL Netapi32.dll

See also

DS_DOMAIN_TRUSTS

Directory Service Functions

NetApiBufferFree