LsaQueryTrustedDomainInfo function (ntsecapi.h)

The LsaQueryTrustedDomainInfo function retrieves information about a trusted domain.

Syntax

NTSTATUS LsaQueryTrustedDomainInfo(
  [in]  LSA_HANDLE                PolicyHandle,
  [in]  PSID                      TrustedDomainSid,
  [in]  TRUSTED_INFORMATION_CLASS InformationClass,
  [out] PVOID                     *Buffer
);

Parameters

[in] PolicyHandle

A handle to the Policy object of a domain controller that has a trust relationship with the domain identified by the TrustedDomainSid parameter. The handle must have the POLICY_VIEW_LOCAL_INFORMATION access right. For more information, see Opening a Policy Object Handle.

[in] TrustedDomainSid

Pointer to the SID of the trusted domain to query.

[in] InformationClass

Specifies one of the following values from the TRUSTED_INFORMATION_CLASS enumeration type. The value indicates the type of information being requested.

Value Meaning
TrustedDomainNameInformation
Retrieves the name of the trusted domain. The Buffer parameter receives a pointer to a TRUSTED_DOMAIN_NAME_INFO structure.
TrustedPosixOffsetInformation
Retrieves the value used to generate Posix user and group identifiers for the trusted domain. The Buffer parameter receives a pointer to a TRUSTED_POSIX_OFFSET_INFO structure.
TrustedPasswordInformation
Retrieves the password for the trusted domain. The Buffer parameter receives a pointer to a TRUSTED_PASSWORD_INFO structure. The handle passed in the PolicyHandle parameter must have the POLICY_GET_PRIVATE_INFORMATION access right.
TrustedDomainInformationEx
Retrieves extended information for the trusted domain. The Buffer parameter receives a pointer to a TRUSTED_DOMAIN_INFORMATION_EX structure.
TrustedDomainInformationBasic
This value is not supported.
TrustedDomainFullInformation
Retrieves complete information for the trusted domain. This information includes the Posix offset information, authentication information, and the extended information returned for the TrustedDomainInformationEx value. The Buffer parameter receives a pointer to a TRUSTED_DOMAIN_FULL_INFORMATION structure.

[out] Buffer

A pointer to a buffer that receives a pointer to a structure that contains the requested information. The type of structure depends on the value of the InformationClass parameter.

When you have finished using the information, free the returned pointer by passing it to LsaFreeMemory.

Return value

If the function succeeds, the function returns STATUS_SUCCESS.

If the function fails, it returns an NTSTATUS value that indicates the error. For more information, see LSA Policy Function Return Values.

You can use the LsaNtStatusToWinError function to convert the NTSTATUS value to a Windows error code.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header ntsecapi.h
Library Advapi32.lib
DLL Advapi32.dll

See also

LsaSetTrustedDomainInformation

POLICY_ACCOUNT_DOMAIN_INFO

POLICY_AUDIT_EVENTS_INFO

POLICY_DNS_DOMAIN_INFO

POLICY_LSA_SERVER_ROLE_INFO

POLICY_MODIFICATION_INFO

POLICY_PRIMARY_DOMAIN_INFO

TRUSTED_INFORMATION_CLASS