mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[WIN32K]
- Enable all debug channels if DEBUGCHANNEL is set to "+all". - Fix GDI objects exclusive locks counting, fixing a memory corruption altogether. - Add a missing lock release on error path. - Add a debug print. svn path=/trunk/; revision=64187
This commit is contained in:
parent
bcaee07f89
commit
85d90c9dff
5 changed files with 53 additions and 12 deletions
|
@ -595,6 +595,16 @@ DbgAddDebugChannel(PPROCESSINFO ppi, WCHAR* channel, WCHAR* level, WCHAR op)
|
|||
DBG_CHANNEL *ChannelEntry;
|
||||
UINT iLevel, iChannel;
|
||||
|
||||
/* Special treatment for the "all" channel */
|
||||
if (wcscmp(channel, L"all") == 0)
|
||||
{
|
||||
for (iChannel = 0; iChannel < DbgChCount; iChannel++)
|
||||
{
|
||||
DbgAddDebugChannel(ppi, DbgChannels[iChannel].Name, level, op);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ChannelEntry = (DBG_CHANNEL*)bsearch(channel,
|
||||
DbgChannels,
|
||||
DbgChCount,
|
||||
|
|
|
@ -37,12 +37,40 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
// Move to gdidbg.h
|
||||
|
||||
FORCEINLINE
|
||||
void
|
||||
INCREASE_THREAD_LOCK_COUNT(
|
||||
_In_ HANDLE hobj)
|
||||
{
|
||||
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
|
||||
DBG_UNREFERENCED_PARAMETER(hobj);
|
||||
if (pti)
|
||||
{
|
||||
#if DBG
|
||||
pti->acExclusiveLockCount[((ULONG_PTR)hobj >> 16) & 0x1f]++;
|
||||
#endif
|
||||
pti->cExclusiveLocks++;
|
||||
}
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
void
|
||||
DECREASE_THREAD_LOCK_COUNT(
|
||||
_In_ HANDLE hobj)
|
||||
{
|
||||
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
|
||||
DBG_UNREFERENCED_PARAMETER(hobj);
|
||||
if (pti)
|
||||
{
|
||||
#if DBG
|
||||
pti->acExclusiveLockCount[((ULONG_PTR)hobj >> 16) & 0x1f]--;
|
||||
#endif
|
||||
pti->cExclusiveLocks--;
|
||||
}
|
||||
}
|
||||
|
||||
#if DBG
|
||||
#define DBG_INCREASE_LOCK_COUNT(pti, hobj) \
|
||||
if (pti) ((PTHREADINFO)pti)->acExclusiveLockCount[((ULONG_PTR)hobj >> 16) & 0x1f]++;
|
||||
#define DBG_DECREASE_LOCK_COUNT(pti, hobj) \
|
||||
if (pti) ((PTHREADINFO)pti)->acExclusiveLockCount[((ULONG_PTR)hobj >> 16) & 0x1f]--;
|
||||
#define ASSERT_SHARED_OBJECT_TYPE(objt) \
|
||||
ASSERT((objt) == GDIObjType_SURF_TYPE || \
|
||||
(objt) == GDIObjType_PAL_TYPE || \
|
||||
|
@ -55,8 +83,6 @@
|
|||
#define ASSERT_TRYLOCK_OBJECT_TYPE(objt) \
|
||||
ASSERT((objt) == GDIObjType_DRVOBJ_TYPE)
|
||||
#else
|
||||
#define DBG_INCREASE_LOCK_COUNT(ppi, hobj)
|
||||
#define DBG_DECREASE_LOCK_COUNT(x, y)
|
||||
#define ASSERT_SHARED_OBJECT_TYPE(objt)
|
||||
#define ASSERT_EXCLUSIVE_OBJECT_TYPE(objt)
|
||||
#define ASSERT_TRYLOCK_OBJECT_TYPE(objt)
|
||||
|
@ -684,7 +710,7 @@ GDIOBJ_TryLockObject(
|
|||
|
||||
/* Increase lock count */
|
||||
pobj->cExclusiveLock++;
|
||||
DBG_INCREASE_LOCK_COUNT(PsGetCurrentProcessWin32Process(), hobj);
|
||||
INCREASE_THREAD_LOCK_COUNT(hobj);
|
||||
DBG_LOGEVENT(&pobj->slhLog, EVENT_LOCK, 0);
|
||||
|
||||
/* Return the object */
|
||||
|
@ -735,7 +761,7 @@ GDIOBJ_LockObject(
|
|||
|
||||
/* Increase lock count */
|
||||
pobj->cExclusiveLock++;
|
||||
DBG_INCREASE_LOCK_COUNT(PsGetCurrentProcessWin32Process(), hobj);
|
||||
INCREASE_THREAD_LOCK_COUNT(hobj);
|
||||
DBG_LOGEVENT(&pobj->slhLog, EVENT_LOCK, 0);
|
||||
|
||||
/* Return the object */
|
||||
|
@ -751,7 +777,7 @@ GDIOBJ_vUnlockObject(POBJ pobj)
|
|||
|
||||
/* Decrease lock count */
|
||||
pobj->cExclusiveLock--;
|
||||
DBG_DECREASE_LOCK_COUNT(PsGetCurrentProcessWin32Process(), pobj->hHmgr);
|
||||
DECREASE_THREAD_LOCK_COUNT(pobj->hHmgr);
|
||||
DBG_LOGEVENT(&pobj->slhLog, EVENT_UNLOCK, 0);
|
||||
|
||||
/* Check if this was the last lock */
|
||||
|
@ -802,7 +828,7 @@ GDIOBJ_hInsertObject(
|
|||
ExAcquirePushLockExclusive(&pobj->pushlock);
|
||||
pobj->cExclusiveLock = 1;
|
||||
pobj->dwThreadId = PtrToUlong(PsGetCurrentThreadId());
|
||||
DBG_INCREASE_LOCK_COUNT(PsGetCurrentProcessWin32Process(), pobj->hHmgr);
|
||||
INCREASE_THREAD_LOCK_COUNT(pobj->hHmgr);
|
||||
|
||||
/* Get object type from the hHmgr field */
|
||||
objt = ((ULONG_PTR)pobj->hHmgr >> 16) & 0xff;
|
||||
|
@ -1000,7 +1026,7 @@ GDIOBJ_vDeleteObject(POBJ pobj)
|
|||
/* Release the pushlock and reenable APCs */
|
||||
ExReleasePushLockExclusive(&pobj->pushlock);
|
||||
KeLeaveCriticalRegion();
|
||||
DBG_DECREASE_LOCK_COUNT(PsGetCurrentProcessWin32Process(), pobj->hHmgr);
|
||||
DECREASE_THREAD_LOCK_COUNT(pobj->hHmgr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -475,7 +475,10 @@ NtUserGetKeyboardLayoutList(
|
|||
UserEnterShared();
|
||||
|
||||
if (!gspklBaseLayout)
|
||||
{
|
||||
UserLeave();
|
||||
return 0;
|
||||
}
|
||||
pKl = gspklBaseLayout;
|
||||
|
||||
if (nBuff == 0)
|
||||
|
|
|
@ -244,6 +244,7 @@ VOID FASTCALL UserEnterExclusive(VOID)
|
|||
VOID FASTCALL UserLeave(VOID)
|
||||
{
|
||||
ASSERT_NOGDILOCKS();
|
||||
ASSERT(UserIsEntered());
|
||||
ExReleaseResourceLite(&UserLock);
|
||||
KeLeaveCriticalRegion();
|
||||
}
|
||||
|
|
|
@ -1258,6 +1258,7 @@ co_WinPosDoWinPosChanging(PWND Window,
|
|||
|
||||
if (!(WinPos->flags & SWP_NOSENDCHANGING))
|
||||
{
|
||||
TRACE("Sending WM_WINDOWPOSCHANGING to hwnd %p.\n", Window->head.h);
|
||||
co_IntSendMessageNoWait(Window->head.h, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue