mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 08:03:03 +00:00
count all gdi handles and serialize removing gdi handles from the table.
svn path=/trunk/; revision=8708
This commit is contained in:
parent
5ca99eb505
commit
42798328cb
1 changed files with 17 additions and 1 deletions
|
@ -19,7 +19,7 @@
|
||||||
/*
|
/*
|
||||||
* GDIOBJ.C - GDI object manipulation routines
|
* GDIOBJ.C - GDI object manipulation routines
|
||||||
*
|
*
|
||||||
* $Id: gdiobj.c,v 1.62 2004/03/09 20:34:28 dwelch Exp $
|
* $Id: gdiobj.c,v 1.63 2004/03/14 12:16:50 weiden Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@
|
||||||
|
|
||||||
/* enable/disable GDI object caching */
|
/* enable/disable GDI object caching */
|
||||||
#define GDI_CACHE_OBJECTS 0
|
#define GDI_CACHE_OBJECTS 0
|
||||||
|
/* count all gdi objects */
|
||||||
|
#define GDI_COUNT_OBJECTS 1
|
||||||
|
|
||||||
/*! Size of the GDI handle table
|
/*! Size of the GDI handle table
|
||||||
* http://www.windevnet.com/documents/s=7290/wdj9902b/9902b.htm
|
* http://www.windevnet.com/documents/s=7290/wdj9902b/9902b.htm
|
||||||
|
@ -89,6 +91,9 @@ typedef struct _GDI_HANDLE_TABLE
|
||||||
{
|
{
|
||||||
WORD wTableSize;
|
WORD wTableSize;
|
||||||
WORD AllocationHint;
|
WORD AllocationHint;
|
||||||
|
#if GDI_COUNT_OBJECTS
|
||||||
|
ULONG HandlesCount;
|
||||||
|
#endif
|
||||||
#if GDI_CACHE_OBJECTS
|
#if GDI_CACHE_OBJECTS
|
||||||
ULONG ObjHdrSize;
|
ULONG ObjHdrSize;
|
||||||
PGDIOBJHDR *CachedObjects;
|
PGDIOBJHDR *CachedObjects;
|
||||||
|
@ -241,6 +246,9 @@ GDIOBJ_iAllocHandleTable (WORD Size)
|
||||||
handleTable = ExAllocatePoolWithTag(PagedPool, MemSize, TAG_GDIHNDTBLE);
|
handleTable = ExAllocatePoolWithTag(PagedPool, MemSize, TAG_GDIHNDTBLE);
|
||||||
ASSERT( handleTable );
|
ASSERT( handleTable );
|
||||||
memset (handleTable, 0, MemSize);
|
memset (handleTable, 0, MemSize);
|
||||||
|
#if GDI_COUNT_OBJECTS
|
||||||
|
handleTable->HandlesCount = 0;
|
||||||
|
#endif
|
||||||
#if GDI_CACHE_OBJECTS
|
#if GDI_CACHE_OBJECTS
|
||||||
handleTable->CachedObjects = &handleTable->Handles[Size];
|
handleTable->CachedObjects = &handleTable->Handles[Size];
|
||||||
handleTable->ObjHdrSize = sizeof(GDIOBJHDR) + GDI_MaxGdiObjHeaderSize();
|
handleTable->ObjHdrSize = sizeof(GDIOBJHDR) + GDI_MaxGdiObjHeaderSize();
|
||||||
|
@ -388,6 +396,9 @@ GDIOBJ_AllocObj(WORD Size, DWORD ObjectType, GDICLEANUPPROC CleanupProc)
|
||||||
newObject->lockline = 0;
|
newObject->lockline = 0;
|
||||||
ExInitializeFastMutex(&newObject->Lock);
|
ExInitializeFastMutex(&newObject->Lock);
|
||||||
HandleTable->Handles[Index] = newObject;
|
HandleTable->Handles[Index] = newObject;
|
||||||
|
#if GDI_COUNT_OBJECTS
|
||||||
|
HandleTable->HandlesCount++;
|
||||||
|
#endif
|
||||||
ExReleaseFastMutex(&HandleTableMutex);
|
ExReleaseFastMutex(&HandleTableMutex);
|
||||||
|
|
||||||
W32Process = PsGetCurrentProcess()->Win32Process;
|
W32Process = PsGetCurrentProcess()->Win32Process;
|
||||||
|
@ -468,7 +479,12 @@ GDIOBJ_FreeObj(HGDIOBJ hObj, DWORD ObjectType, DWORD Flag)
|
||||||
#else
|
#else
|
||||||
ExFreePool(objectHeader);
|
ExFreePool(objectHeader);
|
||||||
#endif
|
#endif
|
||||||
|
ExAcquireFastMutexUnsafe (&HandleTableMutex);
|
||||||
HandleTable->Handles[GDI_HANDLE_GET_INDEX(hObj)] = NULL;
|
HandleTable->Handles[GDI_HANDLE_GET_INDEX(hObj)] = NULL;
|
||||||
|
#if GDI_COUNT_OBJECTS
|
||||||
|
HandleTable->HandlesCount--;
|
||||||
|
#endif
|
||||||
|
ExReleaseFastMutexUnsafe (&HandleTableMutex);
|
||||||
|
|
||||||
W32Process = PsGetCurrentProcess()->Win32Process;
|
W32Process = PsGetCurrentProcess()->Win32Process;
|
||||||
if(W32Process)
|
if(W32Process)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue