IoInitializeTimer

NTSTATUS
    IoInitializeTimer(

        IN PDEVICE_OBJECT  DeviceObject,
        IN PIO_TIMER_ROUTINE  TimerRoutine,
        IN PVOID  Context
        );

IoInitializeTimer sets up a driver-supplied IoTimer routine associated with a given device object.

Parameters

DeviceObject
Points to a device object representing a device on which I/O operations can time out.
TimerRoutine
Points to the driver-supplied IoTimer routine, which is declared as follows:
VOID
(*PIO_TIMER_ROUTINE) (
    IN PDEVICE_OBJECT DeviceObject,
    IN PVOID Context
    );
Context
Points to the driver-determined context with which its IoTimer routine will be called.

Return Value

IoInitializeTimer returns STATUS_SUCCESS if the IoTimer routine is set up.

Comments

A driver’s IoTimer routine is called once per second after the driver enables the timer by calling IoStartTimer.

The driver can disable the timer by calling IoStopTimer and can re-enable it again with IoStartTimer.

Callers of IoInitializeTimer must be running at IRQL PASSIVE_LEVEL.

When the timer is running, the I/O Manager calls the driver-supplied IoTimer routine once per second. Drivers whose time-out routines should be called at variable intervals or at intervals of finer granularity can set up a CustomTimerDpc routine and use the Ke..Timer routines.

See Also

IoStartTimer, IoStopTimer, KeInitializeTimer, KeSetTimer