36#define HandleToScm(Handle) (PSIDCACHEMGR)(Handle)
37#define ScmToHandle(Scm) (HANDLE)(Scm)
84 if (QueueEntry->ListEntry.Flink !=
NULL)
91 QueueEntry->Callbacks);
181 if (SystemName !=
NULL && SystemName[0] !=
L'\0')
183 NameLength =
wcslen(SystemName);
189 LsaSystemName.
Buffer = SystemName;
192 psn = &LsaSystemName;
200 &LsaObjectAttributes,
225 DWORD AccountNameSize, DomainNameSize = 0;
236 SidNameUse =
Names->Use;
238 if (ReferencedDomain !=
NULL &&
239 Names->DomainIndex >= 0)
241 Domain = &ReferencedDomain->
Domains[
Names->DomainIndex];
242 DomainName = &Domain->
Name;
259 (
PVOID*)&PolicyAccountDomainInfo);
262 DomainName = &PolicyAccountDomainInfo->DomainName;
278 AccountNameSize =
Names->Name.Length;
279 if (DomainName !=
NULL)
281 DomainNameSize = DomainName->
Length;
287 (((AccountNameSize + DomainNameSize) + 2) *
sizeof(
WCHAR)));
298 if (DomainName !=
NULL)
311 if (PolicyAccountDomainInfo !=
NULL)
347 for (CurrentEntry = scm->CacheListHead.
Flink;
348 CurrentEntry != &scm->CacheListHead;
349 CurrentEntry = CurrentEntry->
Flink)
356 (
PSID)(CacheEntry + 1)))
359 ULONG AccountNameLen, DomainNameLen;
367 (((AccountNameLen + 1) +
368 (DomainNameLen + 1)) *
sizeof(
WCHAR));
382 Buffer += AccountNameLen + 1;
407 SIZE_T AccountNameLen = 0;
414 CacheEntrySize += SidLen;
416 AccountNameLen =
wcslen(ReqResult->AccountName);
417 CacheEntrySize += (AccountNameLen + 1) *
sizeof(
WCHAR);
419 DomainNameLen =
wcslen(ReqResult->DomainName);
420 CacheEntrySize += (
wcslen(ReqResult->DomainName) + 1) *
sizeof(
WCHAR);
425 if (CacheEntry !=
NULL)
429 CacheEntry->
SidNameUse = ReqResult->SidNameUse;
433 (
PSID)(CacheEntry + 1),
439 ReqResult->AccountName);
440 lpBuf += AccountNameLen + 1;
444 ReqResult->DomainName);
445 lpBuf += DomainNameLen + 1;
498 if (QueueEntry !=
NULL)
518 if (ReqResult !=
NULL)
528 if (ReqResult !=
NULL)
536 ReqResult = FoundReqResult;
545 i < QueueEntry->CallbackCount)
601 if (SystemName ==
NULL)
607 SystemName[
wcslen(SystemName) + 1]));
700 if (scm->QueueLookingUp !=
NULL &&
702 (
PSID)(scm->QueueLookingUp + 1)))
704 FoundEntry = scm->QueueLookingUp;
708 for (CurrentEntry = scm->QueueListHead.
Flink;
709 CurrentEntry != &scm->QueueListHead;
710 CurrentEntry = CurrentEntry->
Flink)
717 (
PSID)(QueueEntry + 1)))
719 FoundEntry = QueueEntry;
725 if (FoundEntry ==
NULL)
732 if (FoundEntry !=
NULL)
735 (
PSID)(FoundEntry + 1),
815 CurrentEntry = CurrentEntry->
Flink)
822 (
PSID)(QueueEntry + 1)))
924 if (ReqResult !=
NULL)
934 if (ReqResult !=
NULL)
942 ReqResult = FoundReqResult;
954 CompletionProc(SidCacheMgr,
959 if (ReqResult !=
NULL)
#define InterlockedIncrement
#define InterlockedDecrement
static HINSTANCE hDllInstance
#define ERROR_NOT_ENOUGH_MEMORY
#define NT_SUCCESS(StatCode)
struct _SIDREQRESULT SIDREQRESULT
VOID(* PSIDREQCOMPLETIONPROC)(IN HANDLE SidCacheMgr, IN PSID Sid, IN PSIDREQRESULT SidRequestResult, IN PVOID Context)
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
NTSTATUS WINAPI LsaLookupSids(IN LSA_HANDLE PolicyHandle, IN ULONG Count, IN PSID *Sids, OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, OUT PLSA_TRANSLATED_NAME *Names)
ULONG WINAPI LsaNtStatusToWinError(IN NTSTATUS Status)
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
BOOL WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
DWORD WINAPI GetLengthSid(PSID pSid)
BOOL WINAPI EqualSid(PSID pSid1, PSID pSid2)
#define HeapFree(x, y, z)
BOOL WINAPI GetModuleHandleExW(IN DWORD dwFlags, IN LPCWSTR lpwModuleName OPTIONAL, OUT HMODULE *phModule)
VOID WINAPI FreeLibraryAndExitThread(HMODULE hLibModule, DWORD dwExitCode)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
static const WCHAR Cleanup[]
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define InitializeListHead(ListHead)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
enum _SID_NAME_USE SID_NAME_USE
#define UNICODE_STRING_MAX_CHARS
@ PolicyAccountDomainInformation
#define POLICY_VIEW_LOCAL_INFORMATION
#define POLICY_LOOKUP_NAMES
#define STATUS_NONE_MAPPED
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
VOID DequeueSidLookup(IN HANDLE SidCacheMgr, IN PSID pSid)
static VOID CacheLookupResults(IN PSIDCACHEMGR scm, IN PSID pSid, IN PSIDREQRESULT ReqResult)
#define HandleToScm(Handle)
struct _SIDCACHECALLBACKINFO * PSIDCACHECALLBACKINFO
VOID DestroySidCacheMgr(IN HANDLE SidCacheMgr)
static BOOL LookupSidInformation(IN PSIDCACHEMGR scm, IN PSID pSid, OUT PSIDREQRESULT *ReqResult)
struct _SIDCACHEENTRY SIDCACHEENTRY
struct _SIDQUEUEENTRY SIDQUEUEENTRY
static VOID CleanupSidCacheMgr(IN PSIDCACHEMGR scm)
struct _SIDCACHECALLBACKINFO SIDCACHECALLBACKINFO
static VOID DereferenceSidCacheMgr(IN PSIDCACHEMGR scm)
static VOID FreeQueueEntry(IN PSIDCACHEMGR scm, IN PSIDQUEUEENTRY QueueEntry)
static DWORD WINAPI LookupThreadProc(IN LPVOID lpParameter)
static BOOL OpenLSAPolicyHandle(IN LPWSTR SystemName, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
VOID ReferenceSidReqResult(IN HANDLE SidCacheMgr, IN PSIDREQRESULT ReqResult)
static BOOL QueueSidLookup(IN PSIDCACHEMGR scm, IN PSID pSid, IN PSIDREQCOMPLETIONPROC CompletionProc, IN PVOID Context)
static BOOL FindSidInCache(IN PSIDCACHEMGR scm, IN PSID pSid, OUT PSIDREQRESULT *ReqResult)
struct _SIDCACHEMGR SIDCACHEMGR
static VOID FreeCacheEntry(IN PSIDCACHEMGR scm, IN PSIDCACHEENTRY CacheEntry)
struct _SIDCACHEENTRY * PSIDCACHEENTRY
static PSIDCACHEMGR ReferenceSidCacheMgr(IN HANDLE SidCacheMgr)
HANDLE CreateSidCacheMgr(IN HANDLE Heap, IN LPCWSTR SystemName)
VOID DereferenceSidReqResult(IN HANDLE SidCacheMgr, IN PSIDREQRESULT ReqResult)
struct _SIDQUEUEENTRY * PSIDQUEUEENTRY
BOOL LookupSidCache(IN HANDLE SidCacheMgr, IN PSID pSid, IN PSIDREQCOMPLETIONPROC CompletionProc, IN PVOID Context)
struct _SIDCACHEMGR * PSIDCACHEMGR
struct _LIST_ENTRY * Flink
PLSA_TRUST_INFORMATION Domains
PSIDREQCOMPLETIONPROC CompletionProc
struct _SIDQUEUEENTRY * QueueLookingUp
PSIDCACHECALLBACKINFO Callbacks
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
#define FIELD_OFFSET(t, f)
#define CONTAINING_RECORD(address, type, field)
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)