reactos/subsys/win32k/ntuser
diff -u -r1.28 -r1.29
--- timer.c 29 Mar 2004 17:02:22 -0000 1.28
+++ timer.c 31 Mar 2004 18:37:12 -0000 1.29
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: timer.c,v 1.28 2004/03/29 17:02:22 navaraf Exp $
+/* $Id: timer.c,v 1.29 2004/03/31 18:37:12 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -61,10 +61,10 @@
static CLIENT_ID MsgTimerThreadId;
-#define IntLockTimerList \
+#define IntLockTimerList() \
ExAcquireFastMutex(&Mutex)
-#define IntUnLockTimerList \
+#define IntUnLockTimerList() \
ExReleaseFastMutex(&Mutex)
/* FUNCTIONS *****************************************************************/
@@ -123,7 +123,7 @@
PMSG_TIMER_ENTRY MsgTimer;
PLIST_ENTRY EnumEntry;
- IntLockTimerList;
+ IntLockTimerList();
EnumEntry = TimerListHead.Flink;
while (EnumEntry != &TimerListHead)
@@ -143,7 +143,35 @@
}
}
- IntUnLockTimerList;
+ IntUnLockTimerList();
+}
+
+
+/*
+ * NOTE: It doesn't kill the timer. It just removes them from the list.
+ */
+VOID FASTCALL
+RemoveTimersWindow(HWND Wnd)
+{
+ PMSG_TIMER_ENTRY MsgTimer;
+ PLIST_ENTRY EnumEntry;
+
+ IntLockTimerList();
+
+ EnumEntry = TimerListHead.Flink;
+ while (EnumEntry != &TimerListHead)
+ {
+ MsgTimer = CONTAINING_RECORD(EnumEntry, MSG_TIMER_ENTRY, ListEntry);
+ EnumEntry = EnumEntry->Flink;
+
+ if (MsgTimer->Msg.hwnd == Wnd)
+ {
+ RemoveEntryList(&MsgTimer->ListEntry);
+ ExFreePool(MsgTimer);
+ }
+ }
+
+ IntUnLockTimerList();
}
@@ -157,10 +185,10 @@
PWINDOW_OBJECT WindowObject;
HANDLE ThreadID;
UINT_PTR Ret = 0;
-
+
ThreadID = PsGetCurrentThreadId();
KeQuerySystemTime(&CurrentTime);
- IntLockTimerList;
+ IntLockTimerList();
if((hWnd == NULL) && !SystemTimer)
{
@@ -169,7 +197,7 @@
if(Index == (ULONG) -1)
{
- IntUnLockTimerList;
+ IntUnLockTimerList();
return 0;
}
@@ -180,14 +208,14 @@
WindowObject = IntGetWindowObject(hWnd);
if(!WindowObject)
{
- IntUnLockTimerList;
+ IntUnLockTimerList();
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return 0;
}
if(WindowObject->OwnerThread != PsGetCurrentThread())
{
- IntUnLockTimerList;
+ IntUnLockTimerList();
IntReleaseWindowObject(WindowObject);
SetLastWin32Error(ERROR_ACCESS_DENIED);
return 0;
@@ -231,7 +259,7 @@
NewTimer = ExAllocatePoolWithTag(PagedPool, sizeof(MSG_TIMER_ENTRY), TAG_TIMER);
if(!NewTimer)
{
- IntUnLockTimerList;
+ IntUnLockTimerList();
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
return 0;
}
@@ -253,7 +281,7 @@
KeSetTimer(&Timer, NewTimer->Timeout, NULL);
}
- IntUnLockTimerList;
+ IntUnLockTimerList();
return Ret;
}
@@ -265,14 +293,14 @@
PMSG_TIMER_ENTRY MsgTimer;
PWINDOW_OBJECT WindowObject;
- IntLockTimerList;
+ IntLockTimerList();
/* window-less timer? */
if((hWnd == NULL) && !SystemTimer)
{
if(!RtlAreBitsSet(&WindowLessTimersBitMap, uIDEvent - 1, 1))
{
- IntUnLockTimerList;
+ IntUnLockTimerList();
/* bit was not set */
/* FIXME: set the last error */
return FALSE;
@@ -285,13 +313,13 @@
WindowObject = IntGetWindowObject(hWnd);
if(!WindowObject)
{
- IntUnLockTimerList;
+ IntUnLockTimerList();
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return FALSE;
}
if(WindowObject->OwnerThread != PsGetCurrentThread())
{
- IntUnLockTimerList;
+ IntUnLockTimerList();
IntReleaseWindowObject(WindowObject);
SetLastWin32Error(ERROR_ACCESS_DENIED);
return FALSE;
@@ -301,7 +329,7 @@
MsgTimer = IntRemoveTimer(hWnd, uIDEvent, PsGetCurrentThreadId(), SystemTimer);
- IntUnLockTimerList;
+ IntUnLockTimerList();
if(MsgTimer == NULL)
{
@@ -316,7 +344,6 @@
return TRUE;
}
-extern VOID STDCALL ValidateNonPagedPool(VOID);
static VOID STDCALL
TimerThreadMain(PVOID StartContext)
{
@@ -343,7 +370,7 @@
ThreadsToDereferenceCount = ThreadsToDereferencePos = 0;
- IntLockTimerList;
+ IntLockTimerList();
KeQuerySystemTime(&CurrentTime);
@@ -412,7 +439,7 @@
KeSetTimer(&Timer, MsgTimer->Timeout, NULL);
}
- IntUnLockTimerList;
+ IntUnLockTimerList();
for (i = 0; i < ThreadsToDereferencePos; i++)
ObDereferenceObject(ThreadsToDereference[i]);
reactos/subsys/win32k/ntuser
diff -u -r1.204 -r1.205
--- window.c 30 Mar 2004 22:49:38 -0000 1.204
+++ window.c 31 Mar 2004 18:37:12 -0000 1.205
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: window.c,v 1.204 2004/03/30 22:49:38 gvg Exp $
+/* $Id: window.c,v 1.205 2004/03/31 18:37:12 gvg Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -53,6 +53,7 @@
#include <include/hook.h>
#include <include/useratom.h>
#include <include/tags.h>
+#include <include/timer.h>
#define NDEBUG
#include <win32k/debug1.h>
@@ -292,6 +293,8 @@
BOOL BelongsToThreadData;
ASSERT(Window);
+
+ RemoveTimersWindow(Window->Self);
IntLockThreadWindows(Window->OwnerThread->Win32Thread);
if(Window->Status & WINDOWSTATUS_DESTROYING)