Fix IoInitializeTimer()

svn path=/trunk/; revision=6537
This commit is contained in:
Gé van Geldorp 2003-11-05 22:49:06 +00:00
parent 49f2b1905a
commit 8eb8bd42c6
2 changed files with 32 additions and 14 deletions

View file

@ -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);

View file

@ -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);
}