LsaSetTrustedDomainInformation function (ntsecapi.h)

The LsaSetTrustedDomainInformation function modifies a Policy object's information about a trusted domain.

Syntax

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

Parameters

[in] PolicyHandle

A handle to the Policy object of a domain controller. The required user rights for this handle depend on the value of the InformationClass parameter. For more information, see Opening a Policy Object Handle.

[in] TrustedDomainSid

Pointer to the SID of the trusted domain whose information is modified. If the InformationClass parameter is set to TrustedDomainNameInformation, this parameter must point to the SID of the domain to add to the list of trusted domains.

[in] InformationClass

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

Value Meaning
TrustedDomainNameInformation
If the specified domain is not in the list of trusted domains, the LsaSetTrustedDomainInformation function adds it. The TrustedDomainSid parameter must be the SID of the domain to add. The Buffer parameter must be a pointer to a TRUSTED_DOMAIN_NAME_INFO structure containing the name of the domain to add.

If the specified domain is already in the list of trusted domains, the function fails.

TrustedPosixOffsetInformation
Sets the value used to generate Posix user and group identifiers. The Buffer parameter must be a pointer to a TRUSTED_POSIX_OFFSET_INFO structure.
TrustedPasswordInformation
Sets the password for the trusted domain. The Buffer parameter must be a pointer to a TRUSTED_PASSWORD_INFO structure containing the old and new passwords for the specified domain. The handle passed in the PolicyHandle parameter must have the POLICY_CREATE_SECRET access right. The old password string can be NULL.

[in] Buffer

Pointer to a structure containing the information to set. The type of structure depends on the value of the InformationClass parameter.

Return value

If the function succeeds, the return value is STATUS_SUCCESS.

If the function fails, the return value is an NTSTATUS code. For more information, see LSA Policy Function Return Values.

You can use the LsaNtStatusToWinError function to convert the NTSTATUS code 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

LsaDeleteTrustedDomain

LsaQueryTrustedDomainInfo

TRUSTED_DOMAIN_NAME_INFO

TRUSTED_INFORMATION_CLASS

TRUSTED_PASSWORD_INFO

TRUSTED_POSIX_OFFSET_INFO