Process Hacker
lsa.c File Reference
#include <ph.h>

Go to the source code of this file.

Functions

NTSTATUS PhOpenLsaPolicy (_Out_ PLSA_HANDLE PolicyHandle, _In_ ACCESS_MASK DesiredAccess, _In_opt_ PUNICODE_STRING SystemName)
 
LSA_HANDLE PhGetLookupPolicyHandle (VOID)
 Retrieves a handle to the local LSA policy with POLICY_LOOKUP_NAMES access.
 
BOOLEAN PhLookupPrivilegeName (_In_ PLUID PrivilegeValue, _Out_ PPH_STRING *PrivilegeName)
 Gets the name of a privilege from its LUID.
 
BOOLEAN PhLookupPrivilegeDisplayName (_In_ PPH_STRINGREF PrivilegeName, _Out_ PPH_STRING *PrivilegeDisplayName)
 Gets the display name of a privilege from its name.
 
BOOLEAN PhLookupPrivilegeValue (_In_ PPH_STRINGREF PrivilegeName, _Out_ PLUID PrivilegeValue)
 Gets the LUID of a privilege from its name.
 
NTSTATUS PhLookupSid (_In_ PSID Sid, _Out_opt_ PPH_STRING *Name, _Out_opt_ PPH_STRING *DomainName, _Out_opt_ PSID_NAME_USE NameUse)
 Gets information about a SID.
 
NTSTATUS PhLookupName (_In_ PPH_STRINGREF Name, _Out_opt_ PSID *Sid, _Out_opt_ PPH_STRING *DomainName, _Out_opt_ PSID_NAME_USE NameUse)
 Gets information about a name.
 
PPH_STRING PhGetSidFullName (_In_ PSID Sid, _In_ BOOLEAN IncludeDomain, _Out_opt_ PSID_NAME_USE NameUse)
 Gets the name of a SID.
 
PPH_STRING PhSidToStringSid (_In_ PSID Sid)
 Gets a SDDL string representation of a SID.
 

Function Documentation

LSA_HANDLE PhGetLookupPolicyHandle ( VOID  )

Retrieves a handle to the local LSA policy with POLICY_LOOKUP_NAMES access.

Remarks
Do not close the handle; it is cached.

Definition at line 58 of file lsa.c.

PPH_STRING PhGetSidFullName ( _In_ PSID  Sid,
_In_ BOOLEAN  IncludeDomain,
_Out_opt_ PSID_NAME_USE  NameUse 
)

Gets the name of a SID.

Parameters
SidA SID to query.
IncludeDomainTRUE to include the domain name, otherwise FALSE.
NameUseA variable which receives the SID's usage.
Returns
A pointer to a string containing the name of the SID in the following format: domain\name. You must free the string using PhDereferenceObject() when you no longer need it. If an error occurs, the function returns NULL.

Definition at line 387 of file lsa.c.

NTSTATUS PhLookupName ( _In_ PPH_STRINGREF  Name,
_Out_opt_ PSID *  Sid,
_Out_opt_ PPH_STRING DomainName,
_Out_opt_ PSID_NAME_USE  NameUse 
)

Gets information about a name.

Parameters
NameA name to query.
SidA variable which receives a pointer to a SID. You must free the SID using PhFree() when you no longer need it.
DomainNameA variable which receives a pointer to a string containing the SID's domain name. You must free the string using PhDereferenceObject() when you no longer need it.
NameUseA variable which receives the SID's usage.

Definition at line 293 of file lsa.c.

BOOLEAN PhLookupPrivilegeDisplayName ( _In_ PPH_STRINGREF  PrivilegeName,
_Out_ PPH_STRING PrivilegeDisplayName 
)

Gets the display name of a privilege from its name.

Parameters
PrivilegeNameThe name of a privilege.
PrivilegeDisplayNameA variable which receives a pointer to a string containing the privilege's display name. You must free the string using PhDereferenceObject() when you no longer need it.

Definition at line 146 of file lsa.c.

BOOLEAN PhLookupPrivilegeName ( _In_ PLUID  PrivilegeValue,
_Out_ PPH_STRING PrivilegeName 
)

Gets the name of a privilege from its LUID.

Parameters
PrivilegeValueThe LUID of a privilege.
PrivilegeNameA variable which receives a pointer to a string containing the privilege name. You must free the string using PhDereferenceObject() when you no longer need it.

Definition at line 114 of file lsa.c.

BOOLEAN PhLookupPrivilegeValue ( _In_ PPH_STRINGREF  PrivilegeName,
_Out_ PLUID  PrivilegeValue 
)

Gets the LUID of a privilege from its name.

Parameters
PrivilegeNameThe name of a privilege.
PrivilegeValueA variable which receives the LUID of the privilege.

Definition at line 181 of file lsa.c.

NTSTATUS PhLookupSid ( _In_ PSID  Sid,
_Out_opt_ PPH_STRING Name,
_Out_opt_ PPH_STRING DomainName,
_Out_opt_ PSID_NAME_USE  NameUse 
)

Gets information about a SID.

Parameters
SidA SID to query.
NameA variable which receives a pointer to a string containing the SID's name. You must free the string using PhDereferenceObject() when you no longer need it.
DomainNameA variable which receives a pointer to a string containing the SID's domain name. You must free the string using PhDereferenceObject() when you no longer need it.
NameUseA variable which receives the SID's usage.

Definition at line 212 of file lsa.c.

NTSTATUS PhOpenLsaPolicy ( _Out_ PLSA_HANDLE  PolicyHandle,
_In_ ACCESS_MASK  DesiredAccess,
_In_opt_ PUNICODE_STRING  SystemName 
)

Definition at line 36 of file lsa.c.

PPH_STRING PhSidToStringSid ( _In_ PSID  Sid)

Gets a SDDL string representation of a SID.

Parameters
SidA SID to query.
Returns
A pointer to a string containing the SDDL representation of the SID. You must free the string using PhDereferenceObject() when you no longer need it. If an error occurs, the function returns NULL.

Definition at line 477 of file lsa.c.