From 8eb8bd42c69f1f814f7d932346059e39b46fa97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Wed, 5 Nov 2003 22:49:06 +0000 Subject: [PATCH] Fix IoInitializeTimer() svn path=/trunk/; revision=6537 --- reactos/include/ddk/iotypes.h | 28 ++++++++++++++++------------ reactos/ntoskrnl/io/timer.c | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/reactos/include/ddk/iotypes.h b/reactos/include/ddk/iotypes.h index c0e766f286d..c3b548710a8 100644 --- a/reactos/include/ddk/iotypes.h +++ b/reactos/include/ddk/iotypes.h @@ -1,4 +1,4 @@ -/* $Id: iotypes.h,v 1.56 2003/09/28 07:37:11 navaraf Exp $ +/* $Id: iotypes.h,v 1.57 2003/11/05 22:49:06 gvg Exp $ * */ @@ -37,6 +37,7 @@ struct _DEVICE_OBJECT; struct _IRP; struct _IO_STATUS_BLOCK; struct _SCSI_REQUEST_BLOCK; +struct _IO_TIMER; /* SIMPLE TYPES *************************************************************/ @@ -102,16 +103,6 @@ typedef VOID STDCALL_FUNC typedef struct _ADAPTER_OBJECT ADAPTER_OBJECT, *PADAPTER_OBJECT; -/* - * PURPOSE: Special timer associated with each device - * NOTES: This is a guess - */ -typedef struct _IO_TIMER -{ - KTIMER timer; - KDPC dpc; -} IO_TIMER, *PIO_TIMER; - typedef struct _IO_SECURITY_CONTEXT { PSECURITY_QUALITY_OF_SERVICE SecurityQos; @@ -917,7 +908,7 @@ typedef struct _DEVICE_OBJECT struct _DEVICE_OBJECT* NextDevice; struct _DEVICE_OBJECT* AttachedDevice; struct _IRP* CurrentIrp; - PIO_TIMER Timer; + struct _IO_TIMER *Timer; ULONG Flags; ULONG Characteristics; PVPB Vpb; @@ -1081,6 +1072,19 @@ typedef VOID STDCALL_FUNC (*PIO_TIMER_ROUTINE)(PDEVICE_OBJECT DeviceObject, PVOID Context); +/* + * PURPOSE: Special timer associated with each device + * NOTES: This is a guess + */ +typedef struct _IO_TIMER +{ + KTIMER timer; + KDPC dpc; + PDEVICE_OBJECT DeviceObject; + PIO_TIMER_ROUTINE TimerRoutine; + PVOID Context; +} IO_TIMER, *PIO_TIMER; + typedef struct _IO_WORKITEM *PIO_WORKITEM; typedef VOID (*PIO_WORKITEM_ROUTINE)(IN PDEVICE_OBJECT DeviceObject, IN PVOID Context); diff --git a/reactos/ntoskrnl/io/timer.c b/reactos/ntoskrnl/io/timer.c index 7b7e322b4c1..6ce81ebb74e 100644 --- a/reactos/ntoskrnl/io/timer.c +++ b/reactos/ntoskrnl/io/timer.c @@ -1,4 +1,4 @@ -/* $Id: timer.c,v 1.9 2003/07/10 15:47:00 royce Exp $ +/* $Id: timer.c,v 1.10 2003/11/05 22:49:06 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -23,6 +23,17 @@ /* FUNCTIONS *****************************************************************/ +static VOID STDCALL +IoTimerCallback(IN PKDPC Dpc, + IN PVOID DeferredContext, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2) +{ + PIO_TIMER Timer = (PIO_TIMER) DeferredContext; + + Timer->TimerRoutine(Timer->DeviceObject, Timer->Context); +} + /* * @implemented */ @@ -44,9 +55,12 @@ IoInitializeTimer(PDEVICE_OBJECT DeviceObject, { DeviceObject->Timer = ExAllocatePoolWithTag(NonPagedPool, sizeof(IO_TIMER), TAG_IO_TIMER); + DeviceObject->Timer->DeviceObject = DeviceObject; + DeviceObject->Timer->TimerRoutine = TimerRoutine; + DeviceObject->Timer->Context = Context; KeInitializeTimer(&(DeviceObject->Timer->timer)); KeInitializeDpc(&(DeviceObject->Timer->dpc), - (PKDEFERRED_ROUTINE)TimerRoutine,Context); + IoTimerCallback, DeviceObject->Timer); return(STATUS_SUCCESS); }