3.5.4.7.3 NetrEnumerateTrustedDomains (Opnum 19)

The NetrEnumerateTrustedDomains method SHOULD<229> return a set of NetBIOS names of trusted domains.

 NTSTATUS NetrEnumerateTrustedDomains(
   [in, unique, string] LOGONSRV_HANDLE ServerName,
   [out] PDOMAIN_NAME_BUFFER DomainNameBuffer
 );

ServerName: The custom binding handle, as defined in section 3.5.4.1.

DomainNameBuffer: A pointer to a DOMAIN_NAME_BUFFER structure, as specified in section 2.2.1.6.1, that contains a list of trusted domain names. The format of domain names contained in the buffer is specified in section 2.2.1.6.1.

Return Values: The method returns 0x00000000 on success; otherwise, it SHOULD return one of the following error codes.

Return Value/Code

Description

0x0000051F

ERROR_NO_LOGON_SERVERS

There are currently no logon servers available to service the logon request.

0x000006FA

ERROR_NO_TRUST_LSA_SECRET

The workstation does not have a trust secret.

0x000006FB

ERROR_NO_TRUST_SAM_ACCOUNT

The security database on the server does not have a computer account for this workstation trust relationship.

The server initializes the DomainNames field of the DOMAIN_NAME_BUFFER to the empty string. The server calls the NetrEnumerateTrustedDomainsEx method and for each PDS_DOMAIN_TRUSTSW element of the NETLOGON_TRUSTED_DOMAIN_ARRAY, appends the NetbiosDomainName field to the DomainNames field of the DOMAIN_NAME_BUFFER (section 2.2.1.6.1). Then the server terminates the DomainNames field with two null bytes.

For details, see section 3.5.4.7.2, Receiving NetrEnumerateTrustedDomainsEx.