1 #pragma once 2 3 typedef struct _USER_REFERENCE_ENTRY 4 { 5 SINGLE_LIST_ENTRY Entry; 6 PVOID obj; 7 } USER_REFERENCE_ENTRY, *PUSER_REFERENCE_ENTRY; 8 9 extern PUSER_HANDLE_TABLE gHandleTable; 10 VOID FASTCALL UserReferenceObject(PVOID obj); 11 PVOID FASTCALL UserReferenceObjectByHandle(HANDLE handle, HANDLE_TYPE type); 12 BOOL FASTCALL UserDereferenceObject(PVOID obj); 13 PVOID FASTCALL UserCreateObject(PUSER_HANDLE_TABLE ht, struct _DESKTOP* pDesktop, PTHREADINFO pti, HANDLE* h,HANDLE_TYPE type , ULONG size); 14 BOOL FASTCALL UserDeleteObject(HANDLE h, HANDLE_TYPE type ); 15 PVOID UserGetObject(PUSER_HANDLE_TABLE ht, HANDLE handle, HANDLE_TYPE type ); 16 PVOID UserGetObjectNoErr(PUSER_HANDLE_TABLE, HANDLE, HANDLE_TYPE); 17 BOOL FASTCALL UserCreateHandleTable(VOID); 18 BOOL FASTCALL UserObjectInDestroy(HANDLE); 19 void DbgUserDumpHandleTable(); 20 PVOID FASTCALL ValidateHandle(HANDLE handle, HANDLE_TYPE type); 21 BOOLEAN UserDestroyObjectsForOwner(PUSER_HANDLE_TABLE Table, PVOID Owner); 22 BOOL FASTCALL UserMarkObjectDestroy(PVOID); 23 PVOID FASTCALL UserAssignmentLock(PVOID *ppvObj, PVOID pvNew); 24 PVOID FASTCALL UserAssignmentUnlock(PVOID *ppvObj); 25 26 static __inline VOID 27 UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry) 28 { 29 PTHREADINFO W32Thread; 30 31 W32Thread = PsGetCurrentThreadWin32Thread(); 32 ASSERT(W32Thread != NULL); 33 ASSERT(UserReferenceEntry != NULL); 34 UserReferenceEntry->obj = obj; 35 UserReferenceObject(obj); 36 PushEntryList(&W32Thread->ReferencesList, &UserReferenceEntry->Entry); 37 } 38 39 static __inline VOID 40 UserDerefObjectCo(PVOID obj) 41 { 42 PTHREADINFO W32Thread; 43 PSINGLE_LIST_ENTRY ReferenceEntry; 44 PUSER_REFERENCE_ENTRY UserReferenceEntry; 45 46 ASSERT(obj != NULL); 47 W32Thread = PsGetCurrentThreadWin32Thread(); 48 ASSERT(W32Thread != NULL); 49 ReferenceEntry = PopEntryList(&W32Thread->ReferencesList); 50 ASSERT(ReferenceEntry != NULL); 51 UserReferenceEntry = CONTAINING_RECORD(ReferenceEntry, USER_REFERENCE_ENTRY, Entry); 52 ASSERT(UserReferenceEntry != NULL); 53 54 ASSERT(obj == UserReferenceEntry->obj); 55 UserDereferenceObject(obj); 56 } 57 58 void FreeProcMarkObject(_In_ PVOID Object); 59 60 /* EOF */ 61