LsaEnumerateAccountRights function

The LsaEnumerateAccountRights function enumerates the privileges assigned to an account.

Syntax

NTSTATUS LsaEnumerateAccountRights(
  LSA_HANDLE          PolicyHandle,
  PSID                AccountSid,
  PLSA_UNICODE_STRING *UserRights,
  PULONG              CountOfRights
);

Parameters

PolicyHandle

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

AccountSid

Pointer to the SID of the account for which to enumerate privileges.

UserRights

Receives a pointer to an array of LSA_UNICODE_STRING structures. Each structure contains the name of a privilege held by the account. For a list of privilege names, see Privilege Constants

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

CountOfRights

Pointer to a variable that receives the number of privileges in the UserRights array.

Return Value

If at least one account right is found, the function succeeds and returns STATUS_SUCCESS.

If no account rights are found or if the function fails for any other reason, the function returns an NTSTATUS code such as FILE_NOT_FOUND. For more information, see LSA Policy Function Return Values. 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

LSA_UNICODE_STRING

LsaAddAccountRights

LsaFreeMemory

LsaRemoveAccountRights