Author: fireball Date: Mon Jul 20 16:01:25 2009 New Revision: 42098
URL: http://svn.reactos.org/svn/reactos?rev=42098&view=rev Log: - Properly implement add_timeout_user / remove_timeout_user (thus eliminating non paged pool leakage of a test implementation). - Debug prints are still turned on because remove_timeout_user seems to not being called.
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/winesup.h [iso-8859-1] Mon Jul 20 16:01:25 2009 @@ -123,7 +123,12 @@ static inline int check_object_access(struct object *obj, unsigned int *access) { return TRUE; };
// timeout stuff -struct timeout_user; +struct timeout_user +{ + KTIMER Timer; + KDPC Dpc; +}; + enum timeout_t; typedef PKDEFERRED_ROUTINE timeout_callback; #define TICKS_PER_SEC 10000000
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/wine/winesup.c [iso-8859-1] Mon Jul 20 16:01:25 2009 @@ -40,35 +40,36 @@
struct timeout_user *add_timeout_user( timeout_t when, timeout_callback func, void *private ) { - PKTIMER Timer; - PKDPC Dpc; LARGE_INTEGER DueTime; + struct timeout_user *TimeoutUser;
DueTime.QuadPart = (LONGLONG)when;
- DPRINT1("add_timeout_user(when %I64d, func %p)\n", when, func); + DPRINT1("add_timeout_user(when %I64d, func %p), current time %I64d\n", when, func, CurrentTime.QuadPart);
- Timer = ExAllocatePool(NonPagedPool, sizeof(KTIMER)); - KeInitializeTimer(Timer); + /* Allocate memory for timeout structure */ + TimeoutUser = ExAllocatePool(NonPagedPool, sizeof(struct timeout_user));
- Dpc = ExAllocatePool(NonPagedPool, sizeof(KDPC)); - KeInitializeDpc(Dpc, func, private); + /* Initialize timer and DPC objects */ + KeInitializeTimer(&TimeoutUser->Timer); + KeInitializeDpc(&TimeoutUser->Dpc, func, private);
- KeSetTimer(Timer, DueTime, Dpc); + /* Set the timer */ + KeSetTimer(&TimeoutUser->Timer, DueTime, &TimeoutUser->Dpc);
- return (struct timeout_user *)Timer; + return TimeoutUser; }
/* remove a timeout user */ void remove_timeout_user( struct timeout_user *user ) { - PKTIMER Timer = (PKTIMER)user; DPRINT1("remove_timeout_user %p\n", user);
- KeCancelTimer(Timer); - ExFreePool(Timer); + /* Cancel the timer */ + KeCancelTimer(&user->Timer);
- // FIXME: Dpc memory is not freed! + /* Free memory */ + ExFreePool(user); }
/* default map_access() routine for objects that behave like an fd */