LsaQueryTrustedDomainInfoByName function (ntsecapi.h)

The LsaQueryTrustedDomainInfoByName function returns information about a trusted domain.

Syntax

NTSTATUS LsaQueryTrustedDomainInfoByName(
  LSA_HANDLE                PolicyHandle,
  PLSA_UNICODE_STRING       TrustedDomainName,
  TRUSTED_INFORMATION_CLASS InformationClass,
  PVOID                     *Buffer
);

Parameters

PolicyHandle

A handle to a Policy object. This handle must have the POLICY_VIEW_LOCAL_INFORMATION access right. For more information, see Opening a Policy Object Handle.

TrustedDomainName

String that contains the name of the trusted domain. This can either be the domain name or the flat name.

InformationClass

Specifies the type of information to retrieve. This parameter can be one of the following values.

Value Meaning
TrustedDomainNameInformation
Name of the trusted domain.
TrustedPosixInformation
Posix offset of the trusted domain.
TrustedPasswordInformation
Returns the password on the outbound side of the trust.
TrustedDomainInformationBasic
This value is not supported.
TrustedDomainInformationEx
Extended trust information, including the basic information and DNS domain name, and attributes about the trust.
TrustedDomainFullInformation
Full information, including the Posix offset and the authentication information.

Buffer

Receives a pointer to the returned buffer that contains the requested information. The format and content of this buffer depend on the information class. For example, if InformationClass is set to TrustedDomainInformationEx, Buffer receives a pointer to a TRUSTED_DOMAIN_INFORMATION_EX structure. For more information, see TRUSTED_INFORMATION_CLASS.

When you have finished using the buffer, free it by calling the LsaFreeMemory function.

Return value

If the function succeeds, the function returns STATUS_SUCCESS.

If the function fails, it returns an NTSTATUS value, which can be one of the following values or one of the LSA Policy Function Return Values.

Value Description
STATUS_ACCESS_DENIED
Caller does not have the appropriate access to complete the operation. For a list of the required access types, see the description of the InformationClass parameter.
STATUS_INSUFFICIENT_ RESOURCES
Insufficient system resources, such as memory, to complete the call.
 

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

Requirements

   
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

LsaFreeMemory

LsaQueryTrustedDomainInfo

LsaSetTrustedDomainInfoByName

TRUSTED_DOMAIN_INFORMATION_EX

TRUSTED_INFORMATION_CLASS