IoInitializeTimer function (wdm.h)

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

Syntax

NTSTATUS IoInitializeTimer(
  [in]           PDEVICE_OBJECT         DeviceObject,
  [in]           PIO_TIMER_ROUTINE      TimerRoutine,
  [in, optional] __drv_aliasesMem PVOID Context
);

Parameters

[in] DeviceObject

Pointer to a device object representing a device on which I/O operations can time out.

[in] TimerRoutine

Pointer to the driver-supplied IoTimer routine.

[in, optional] Context

Pointer 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.

Remarks

IoInitializeTimer should be called only once per device object.

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 reenable it again with IoStartTimer.

The driver's IoTimer routine is called at IRQL = DISPATCH_LEVEL and therefore must not contain pageable code.

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 KeXxxTimer routines.

Requirements

Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport), IrqlIoPassive5(wdm), PowerIrpDDis(wdm)

See also

IoStartTimer

IoStopTimer

IoTimer

KeInitializeTimer

KeSetTimer