LsaQueryInformationPolicy function (ntsecapi.h)

The LsaQueryInformationPolicy function retrieves information about a Policy object.

Syntax

NTSTATUS LsaQueryInformationPolicy(
  [in]  LSA_HANDLE               PolicyHandle,
  [in]  POLICY_INFORMATION_CLASS InformationClass,
  [out] PVOID                    *Buffer
);

Parameters

[in] 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.

[in] InformationClass

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

Value Meaning
PolicyAuditEventsInformation
Retrieves the system's auditing rules. The handle passed in the PolicyHandle parameter must have the POLICY_VIEW_AUDIT_INFORMATION access right. The Buffer parameter receives a pointer to a POLICY_AUDIT_EVENTS_INFO structure.
PolicyPrimaryDomainInformation
Retrieves the name and SID of the system's primary domain. The handle passed in the PolicyHandle parameter must have the POLICY_VIEW_LOCAL_INFORMATION access right. The Buffer parameter receives a pointer to a POLICY_PRIMARY_DOMAIN_INFO structure.
PolicyAccountDomainInformation
Retrieves the name and SID of the system's account domain. The handle passed in the PolicyHandle parameter must have the POLICY_VIEW_LOCAL_INFORMATION access right. The Buffer parameter receives a pointer to a POLICY_ACCOUNT_DOMAIN_INFO structure.
PolicyLsaServerRoleInformation
Retrieves the role of an LSA server. The handle passed in the PolicyHandle parameter must have the POLICY_VIEW_LOCAL_INFORMATION access right. The Buffer parameter receives a pointer to a POLICY_LSA_SERVER_ROLE_INFO structure.
PolicyModificationInformation
Retrieves information about the creation time and last modification of the LSA database. The handle passed in the PolicyHandle parameter must have the POLICY_VIEW_LOCAL_INFORMATION access right. The Buffer parameter receives a pointer to a POLICY_MODIFICATION_INFO structure.
PolicyDnsDomainInformation
Retrieves the 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_VIEW_LOCAL_INFORMATION access right. The Buffer parameter receives a pointer to a POLICY_DNS_DOMAIN_INFO structure.

[out] Buffer

Pointer to a variable that receives a pointer to a structure containing the requested information. The type of structure depends on the value of the InformationClass parameter.

When you no longer need the information, pass the returned pointer to LsaFreeMemory.

Return value

If the LsaQueryInformationPolicy 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.

Remarks

For an example that demonstrates calling this function see Managing Policy Information.

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

LsaFreeMemory

LsaSetInformationPolicy

POLICY_ACCOUNT_DOMAIN_INFO

POLICY_AUDIT_EVENTS_INFO

POLICY_DNS_DOMAIN_INFO

POLICY_INFORMATION_CLASS

POLICY_LSA_SERVER_ROLE_INFO

POLICY_MODIFICATION_INFO

POLICY_PRIMARY_DOMAIN_INFO