Author: tkreuzer Date: Sat Mar 5 10:21:07 2011 New Revision: 50969
URL: http://svn.reactos.org/svn/reactos?rev=50969&view=rev Log: [WIN32K] Add A function to dump all locked handles and call it when an assertion about 0 locks fails.
Modified: trunk/reactos/subsystems/win32/win32k/include/gdidebug.h trunk/reactos/subsystems/win32/win32k/objects/gdidbg.c
Modified: trunk/reactos/subsystems/win32/win32k/include/gdidebug.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/gdidebug.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/gdidebug.h [iso-8859-1] Sat Mar 5 10:21:07 2011 @@ -20,6 +20,7 @@ void IntDumpHandleTable(PGDI_HANDLE_TABLE HandleTable); ULONG CaptureStackBackTace(PVOID* pFrames, ULONG nFramesToCapture); BOOL GdiDbgHTIntegrityCheck(); +void GdiDbgDumpLockedHandles();
#define DBGENABLE(ch) gulDebugChannels |= (ch); #define DBGDISABLE(ch) gulDebugChannels &= ~(ch); @@ -96,17 +97,19 @@ #define ID_Win32PostServiceHook 'WSH1'
FORCEINLINE void -DbgAssertNoGdiLocks(char * pszFile, ULONG nLine) +GdiDbgAssertNoLocks(char * pszFile, ULONG nLine) { PTHREADINFO pti = (PTHREADINFO)PsGetCurrentThreadWin32Thread(); if (pti && pti->cExclusiveLocks != 0) { DbgPrint("(%s:%ld) There are %ld exclusive locks!\n", pszFile, nLine, pti->cExclusiveLocks); + GdiDbgDumpLockedHandles(); ASSERT(FALSE); } } -#define ASSERT_NOGDILOCKS() DbgAssertNoGdiLocks(__FILE__,__LINE__) + +#define ASSERT_NOGDILOCKS() GdiDbgAssertNoLocks(__FILE__,__LINE__) #else #define ASSERT_NOGDILOCKS() #endif
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdidbg.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdidbg.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdidbg.c [iso-8859-1] Sat Mar 5 10:21:07 2011 @@ -293,6 +293,30 @@ #endif /* GDI_DEBUG */
void +GdiDbgDumpLockedHandles() +{ + ULONG i; + + for (i = RESERVE_ENTRIES_COUNT; i < GDI_HANDLE_COUNT; i++) + { + PGDI_TABLE_ENTRY pEntry = &GdiHandleTable->Entries[i]; + + if (pEntry->Type & GDI_ENTRY_BASETYPE_MASK) + { + BASEOBJECT *pObject = pEntry->KernelData; + if (pObject->cExclusiveLock > 0) + { + DPRINT1("Locked object: %lx, type = %lx. allocated from:\n", + i, pEntry->Type); + GDIDBG_TRACEALLOCATOR(i); + DPRINT1("Locked from:\n"); + GDIDBG_TRACELOCKER(i); + } + } + } +} + +void NTAPI DbgPreServiceHook(ULONG ulSyscallId, PULONG_PTR pulArguments) {