lsaaddaccountrights (advapi32)
Last changed: slkell02@yahoo.com-168.182.1.254

.
Summary
The LsaAddAccountRights function assigns one or more privileges to an account. If the account does not exist, LsaAddAccountRights creates it.

C# Signature:

[DllImport("advapi32.dll", SetLastError=true, PreserveSig=true)]
static extern uint LsaAddAccountRights(
   IntPtr PolicyHandle,
   IntPtr AccountSid,
   LSA_UNICODE_STRING[] UserRights,
   uint CountOfRights);

VB Signature:

Declare Function LsaAddAccountRights Lib "advapi32.dll" (TODO) As TODO

User-Defined Types:

None.

Notes:

From the SDK:

If the function succeeds, the return value is STATUS_SUCCESS.

If the function fails, the return value is an NTSTATUS code, which can be the following value or one of the LSA Policy Function Return Values.

Return code Description

STATUS_NO_SUCH_PRIVILEGE One of the privilege names is invalid.

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

Tips & Tricks:

Please add some!

Sample Code:

See LsaOpenPolicy

Alternative Managed API:

Do you know one? Please contribute it!

Documentation