uLib  User mode C/C++ extended API library for Win32 programmers.
UserMode LSA Support

Module Description

Provide LSA access for applications.
#include <uLib/UmLsa.h>

Some of LSA is available through NtSecApi.h, and can be readily used in usermode.
However, the parts available through NtLsa.h have the usual DDK quirks when trying
to use them in user mode. This module provides function pointers and declarations
to cover some useful NtLsa parts. Note: LSA is only partially documented by MSDN.

This module also provide supplementary APIs that make your task easier
when you have to work with the LSA.

Groups

 Supplementary uLib APIs
 
 Local User Group Lists
 
 Account Object APIs
 
 Policy Object APIs
 
 Local Trusted Domain Object APIs
 
 Secret Object APIs
 
 Privilege Object APIs
 
 APIs for NT 4.0 (SUR release)
 
 Security System Access Flags.
 
 Policy Data and Flags
 

Namespaces

 uLib
 

Macros

#define NT_SUCCESS(rc)   ((rc) >= STATUS_SUCCESS)
 
#define NT_ERROR(Status)   (((ULONG)(Status) >> 30) == 3)
 

Functions

bool InitLsaFunc ()
 
bool OpenLsaPolicy (CSTR Machine, ACCESS_MASK Access, PLSA_HANDLE phPolicy)
 
LSA_HANDLE LsaCloseEx (LSA_HANDLE hLsa)
 

Macro Definition Documentation

◆ NT_SUCCESS

#define NT_SUCCESS (   rc)    ((rc) >= STATUS_SUCCESS)

Definition at line 29 of file UmLsa.h.

◆ NT_ERROR

#define NT_ERROR (   Status)    (((ULONG)(Status) >> 30) == 3)

Definition at line 33 of file UmLsa.h.

Function Documentation

◆ InitLsaFunc()

bool InitLsaFunc ( )
Note
InitLsaFunc must be called before you can use any UmLsa functions.
It initializes the LSA function pointers, e.g. _LsaEnumerateAccounts().

Definition at line 19 of file UmLsa.cpp.

◆ OpenLsaPolicy()

bool OpenLsaPolicy ( CSTR  Machine,
ACCESS_MASK  Access,
PLSA_HANDLE  phPolicy 
)

Transmutable version of LsaOpenPolicy.
Easy to use, since you don't need to fiddle with UNICODE_STRING and possible wide translation.

Parameters
[in]MachineTarget system. Use NULL for the local machine, otherwise "the_computer" or "\\the_computer".
[in]AccessRequested access rights, f.ex. POLICY_ALL_ACCESS.
[out]phPolicyReceives a handle to the policy object.

Definition at line 132 of file UmLsa.cpp.

◆ LsaCloseEx()

LSA_HANDLE LsaCloseEx ( LSA_HANDLE  hLsa)

LsaCloseEx returns NULL on success, else hLsa and GetLastError.
Typical use:

hPolicy = LsaCloseEx( hPolicy );

Definition at line 155 of file UmLsa.cpp.