From: James Tabor Date: Sun, 8 Dec 2013 22:44:02 +0000 (+0000) Subject: [Win32k] X-Git-Tag: ReactOS-0.3.16~564 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=43e1c8ae59a7bee8823db75a27456966d7a0c3d5;ds=sidebyside [Win32k] - Fix timer for CORE-4701. Test application now works. svn path=/trunk/; revision=61250 --- diff --git a/reactos/win32ss/user/ntuser/msgqueue.c b/reactos/win32ss/user/ntuser/msgqueue.c index e9fb5d25dc4..aaeef187961 100644 --- a/reactos/win32ss/user/ntuser/msgqueue.c +++ b/reactos/win32ss/user/ntuser/msgqueue.c @@ -1239,7 +1239,7 @@ MsqPostMessage(PTHREADINFO pti, Message->dwQEvent = dwQEvent; Message->QS_Flags = MessageBits; Message->pti = pti; - MsqWakeQueue(pti, MessageBits, (MessageBits & QS_TIMER ? FALSE : TRUE)); + MsqWakeQueue(pti, MessageBits, TRUE); } VOID FASTCALL diff --git a/reactos/win32ss/user/ntuser/timer.c b/reactos/win32ss/user/ntuser/timer.c index c0355e96ac8..54e1a4cc5b8 100644 --- a/reactos/win32ss/user/ntuser/timer.c +++ b/reactos/win32ss/user/ntuser/timer.c @@ -16,8 +16,6 @@ DBG_DEFAULT_CHANNEL(UserTimer); static LIST_ENTRY TimersListHead; static LONG TimeLast = 0; -#define MAX_ELAPSE_TIME 0x7FFFFFFF - /* Windows 2000 has room for 32768 window-less timers */ #define NUM_WINDOW_LESS_TIMERS 32768 @@ -189,25 +187,25 @@ IntSetTimer( PWND Window, #if 0 /* Windows NT/2k/XP behaviour */ - if (Elapse > MAX_ELAPSE_TIME) + if (Elapse > USER_TIMER_MAXIMUM) { TRACE("Adjusting uElapse\n"); Elapse = 1; } #else /* Windows XP SP2 and Windows Server 2003 behaviour */ - if (Elapse > MAX_ELAPSE_TIME) + if (Elapse > USER_TIMER_MAXIMUM) { TRACE("Adjusting uElapse\n"); - Elapse = MAX_ELAPSE_TIME; + Elapse = USER_TIMER_MAXIMUM; } #endif /* Windows 2k/XP and Windows Server 2003 SP1 behaviour */ - if (Elapse < 10) + if (Elapse < USER_TIMER_MINIMUM) { TRACE("Adjusting uElapse\n"); - Elapse = 10; // 1024hz .9765625 ms, set to 10.0 ms (+/-)1 ms + Elapse = USER_TIMER_MINIMUM; // 1024hz .9765625 ms, set to 10.0 ms (+/-)1 ms } /* Passing an IDEvent of 0 and the SetTimer returns 1. @@ -407,9 +405,9 @@ PostTimerMessages(PWND Window) Msg.wParam = (WPARAM) pTmr->nID; Msg.lParam = (LPARAM) pTmr->pfn; - MsqPostMessage(pti, &Msg, FALSE, QS_TIMER, 0); + MsqPostMessage(pti, &Msg, FALSE, (QS_POSTMESSAGE|QS_ALLPOSTMESSAGE), 0); pTmr->flags &= ~TMRF_READY; - pti->cTimersReady++; + ClearMsgBitsMask(pti, QS_TIMER); Hit = TRUE; // Now move this entry to the end of the list so it will not be // called again in the next msg loop. @@ -480,10 +478,11 @@ ProcessTimers(VOID) { pTmr->flags |= TMRF_READY; // Set timer ready to be ran. // Set thread message queue for this timer. - if (pTmr->pti->MessageQueue) + if (pTmr->pti) { // Wakeup thread + pTmr->pti->cTimersReady++; ASSERT(pTmr->pti->pEventQueueServer != NULL); - KeSetEvent(pTmr->pti->pEventQueueServer, IO_NO_INCREMENT, FALSE); + MsqWakeQueue(pTmr->pti, QS_TIMER, TRUE); } } }