mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 13:45:56 +00:00
Win32k Timers:
- This is relative to bugs 3634 and 2393. Please leave additional information in bug report 2393. - Timer code should not be associated with message queues, since theses types of queues are subject to being destroyed. This creates a problem of loosing timers. - This is a first part of a rewrite of the timers. Moving the timers from the message queue to a linked list very similar to our DCE code. This will simplify timer handling too. svn path=/trunk/; revision=35138
This commit is contained in:
parent
79590b9458
commit
762c1e58de
3 changed files with 48 additions and 9 deletions
|
@ -1,6 +1,18 @@
|
||||||
#ifndef _WIN32K_TIMER_H
|
#ifndef _WIN32K_TIMER_H
|
||||||
#define _WIN32K_TIMER_H
|
#define _WIN32K_TIMER_H
|
||||||
|
|
||||||
|
typedef struct _TIMER
|
||||||
|
{
|
||||||
|
LIST_ENTRY ptmrList;
|
||||||
|
PW32THREADINFO pti;
|
||||||
|
PWINDOW_OBJECT pWnd; // hWnd
|
||||||
|
UINT_PTR nID; // Specifies a nonzero timer identifier.
|
||||||
|
INT cmsCountdown; // uElapse
|
||||||
|
INT cmsRate; // uElapse
|
||||||
|
FLONG flags;
|
||||||
|
TIMERPROC pfn; // lpTimerFunc
|
||||||
|
} TIMER, *PTIMER;
|
||||||
|
|
||||||
NTSTATUS FASTCALL InitTimerImpl(VOID);
|
NTSTATUS FASTCALL InitTimerImpl(VOID);
|
||||||
BOOL FASTCALL IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer);
|
BOOL FASTCALL IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer);
|
||||||
UINT_PTR FASTCALL IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer);
|
UINT_PTR FASTCALL IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer);
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ NtUserSetWindowsHookEx(
|
||||||
ModuleName.MaximumLength);
|
ModuleName.MaximumLength);
|
||||||
if (! NT_SUCCESS(Status))
|
if (! NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ExFreePool(Hook->ModuleName.Buffer);
|
ExFreePool(Hook->ModuleName.Buffer);
|
||||||
UserDereferenceObject(Hook);
|
UserDereferenceObject(Hook);
|
||||||
IntRemoveHook(Hook, WinStaObj, FALSE);
|
IntRemoveHook(Hook, WinStaObj, FALSE);
|
||||||
if (NULL != Thread)
|
if (NULL != Thread)
|
||||||
|
|
|
@ -16,12 +16,11 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id$
|
/*
|
||||||
*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* PURPOSE: Window timers messages
|
* PURPOSE: Window timers messages
|
||||||
* FILE: subsys/win32k/ntuser/timer.c
|
* FILE: subsystems/win32/win32k/ntuser/timer.c
|
||||||
* PROGRAMER: Gunnar
|
* PROGRAMER: Gunnar
|
||||||
* Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
* Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
||||||
* REVISION HISTORY: 10/04/2003 Implemented System Timers
|
* REVISION HISTORY: 10/04/2003 Implemented System Timers
|
||||||
|
@ -37,6 +36,8 @@
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
|
static PTIMER FirstpTmr = NULL;
|
||||||
|
|
||||||
/* Windows 2000 has room for 32768 window-less timers */
|
/* Windows 2000 has room for 32768 window-less timers */
|
||||||
#define NUM_WINDOW_LESS_TIMERS 1024
|
#define NUM_WINDOW_LESS_TIMERS 1024
|
||||||
|
|
||||||
|
@ -148,20 +149,40 @@ IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL S
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
|
IntKillTimer(HWND Wnd, UINT_PTR IDEvent, BOOL SystemTimer)
|
||||||
{
|
{
|
||||||
|
PWINDOW_OBJECT Window = NULL;
|
||||||
|
|
||||||
DPRINT("IntKillTimer wnd %x id %p systemtimer %s\n",
|
DPRINT("IntKillTimer wnd %x id %p systemtimer %s\n",
|
||||||
Wnd, IDEvent, SystemTimer ? "TRUE" : "FALSE");
|
Wnd, IDEvent, SystemTimer ? "TRUE" : "FALSE");
|
||||||
|
|
||||||
if (! MsqKillTimer(PsGetCurrentThreadWin32Thread()->MessageQueue, Wnd,
|
if (Wnd)
|
||||||
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to locate timer in message queue\n");
|
Window = UserGetWindowObject(Wnd);
|
||||||
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
if (! MsqKillTimer(PsGetCurrentThreadWin32Thread()->MessageQueue, Wnd,
|
||||||
|
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
||||||
|
{
|
||||||
|
// Give it another chance to find the timer.
|
||||||
|
if (Window && !( MsqKillTimer(Window->MessageQueue, Wnd,
|
||||||
|
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER)))
|
||||||
|
{
|
||||||
|
DPRINT1("Unable to locate timer in message queue for Window.\n");
|
||||||
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* window-less timer? */
|
/* window-less timer? */
|
||||||
if ((Wnd == NULL) && ! SystemTimer)
|
if ((Wnd == NULL) && ! SystemTimer)
|
||||||
{
|
{
|
||||||
|
if (! MsqKillTimer(PsGetCurrentThreadWin32Thread()->MessageQueue, Wnd,
|
||||||
|
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
|
||||||
|
{
|
||||||
|
DPRINT1("Unable to locate timer in message queue for Window-less timer.\n");
|
||||||
|
SetLastWin32Error(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Release the id */
|
/* Release the id */
|
||||||
IntLockWindowlessTimerBitmap();
|
IntLockWindowlessTimerBitmap();
|
||||||
|
|
||||||
|
@ -195,6 +216,12 @@ InitTimerImpl(VOID)
|
||||||
/* yes we need this, since ExAllocatePool isn't supposed to zero out allocated memory */
|
/* yes we need this, since ExAllocatePool isn't supposed to zero out allocated memory */
|
||||||
RtlClearAllBits(&WindowLessTimersBitMap);
|
RtlClearAllBits(&WindowLessTimersBitMap);
|
||||||
|
|
||||||
|
if (!FirstpTmr)
|
||||||
|
{
|
||||||
|
FirstpTmr = ExAllocatePoolWithTag(PagedPool, sizeof(TIMER), TAG_TIMERBMP);
|
||||||
|
if (FirstpTmr) InitializeListHead(&FirstpTmr->ptmrList);
|
||||||
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue