LsaSetInformationPolicy function

The LsaSetInformationPolicy function modifies information in a Policy object.

Syntax

NTSTATUS LsaSetInformationPolicy(
  LSA_HANDLE               PolicyHandle,
  POLICY_INFORMATION_CLASS InformationClass,
  PVOID                    Buffer
);

Parameters

PolicyHandle

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

InformationClass

Specifies one of the following values from the POLICY_INFORMATION_CLASS enumeration type. The value indicates the type of information to set.

Value Meaning
PolicyAuditEventsInformation
Sets the system's auditing rules. The handle passed in the PolicyHandle parameter must have the POLICY_SET_AUDIT_REQUIREMENTS access right. The Buffer parameter must be a pointer to a POLICY_AUDIT_EVENTS_INFO structure.
PolicyPrimaryDomainInformation
Sets the name and SID of the system's primary domain. The handle passed in the PolicyHandle parameter must have the POLICY_TRUST_ADMIN access right. The Buffer parameter must be a pointer to a POLICY_PRIMARY_DOMAIN_INFO structure.
PolicyAccountDomainInformation
Sets the name and SID of the system's account domain. The handle passed in the PolicyHandle parameter must have the POLICY_TRUST_ADMIN access right. The Buffer parameter must be a pointer to a POLICY_ACCOUNT_DOMAIN_INFO structure.
PolicyDnsDomainInformation
Sets Domain Name System (DNS) information about the primary domain associated with the Policy object. The handle passed in the PolicyHandle parameter must have the POLICY_TRUST_ADMIN access right. The Buffer parameter must be a pointer to a POLICY_DNS_DOMAIN_INFO structure.
PolicyLsaServerRoleInformation
Sets the role of an LSA server. The handle passed in the PolicyHandle parameter must have the POLICY_SERVER_ADMIN access right. The Buffer parameter must be a pointer to a POLICY_LSA_SERVER_ROLE_INFO structure.

Changing a server's role from primary to backup has no effect (although the function returns STATUS_SUCCESS). Changing a server's role from backup to primary requires extensive network operations and may be slow.

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

   
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

POLICY_ACCOUNT_DOMAIN_INFO

POLICY_AUDIT_EVENTS_INFO

POLICY_DNS_DOMAIN_INFO

POLICY_LSA_SERVER_ROLE_INFO

POLICY_PRIMARY_DOMAIN_INFO