Author: mjmartin Date: Mon Jun 7 15:37:43 2010 New Revision: 47658
URL: http://svn.reactos.org/svn/reactos?rev=47658&view=rev Log: [win32k] - Change the number of windowless timers from 1024 to 32768. - When destroying windowless timers, clear the bit number (IDEvent) in the bitmap so the bit number can be reused. - Only create a windowless timer if there is no windowless timer matching IDEvent. - Fixes case where applications create too many windowless timers and/or run out of windowless timers.
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] Mon Jun 7 15:37:43 2010 @@ -24,7 +24,7 @@ #define MAX_ELAPSE_TIME 0x7FFFFFFF
/* Windows 2000 has room for 32768 window-less timers */ -#define NUM_WINDOW_LESS_TIMERS 1024 +#define NUM_WINDOW_LESS_TIMERS 32768
static FAST_MUTEX Mutex; static RTL_BITMAP WindowLessTimersBitMap; @@ -94,6 +94,13 @@ { /* Set the flag, it will be removed when ready */ RemoveEntryList(&pTmr->ptmrList); + if ((pTmr->pWnd == NULL) && (!(pTmr->flags & TMRF_SYSTEM))) + { + DPRINT("Clearing Bit %d)\n", pTmr->nID); + IntLockWindowlessTimerBitmap(); + RtlClearBit(&WindowLessTimersBitMap, pTmr->nID); + IntUnlockWindowlessTimerBitmap(); + } UserDereferenceObject(pTmr); Ret = UserDeleteObject( UserHMGetHandle(pTmr), otTimer); } @@ -224,9 +231,15 @@ Elapse = 10; }
- if ((Window == NULL) && (!(Type & TMRF_SYSTEM))) + if ((Window) && (IDEvent == 0)) + IDEvent = 1; + + pTmr = FindTimer(Window, IDEvent, Type, FALSE); + + if ((!pTmr) && (Window == NULL) && (!(Type & TMRF_SYSTEM))) { IntLockWindowlessTimerBitmap(); + IDEvent = RtlFindClearBitsAndSet(&WindowLessTimersBitMap, 1, HintIndex);
if (IDEvent == (UINT_PTR) -1) @@ -237,15 +250,11 @@ return 0; }
- HintIndex = ++IDEvent; + Ret = IDEvent; + //HintIndex = IDEvent + 1; IntUnlockWindowlessTimerBitmap(); - Ret = IDEvent; - } - - if ((Window) && (IDEvent == 0)) - IDEvent = 1; - - pTmr = FindTimer(Window, IDEvent, Type, FALSE); + } + if (!pTmr) { pTmr = CreateTimer();