The KeSetTimer routine sets the absolute or relative interval at which a timer object is to be set to a signaled state and, optionally, supplies a CustomTimerDpc routine to be executed when that interval expires.
NTKERNELAPI BOOLEAN KeSetTimer( PKTIMER Timer, LARGE_INTEGER DueTime, PKDPC Dpc );
Specifies the absolute or relative time at which the timer is to expire. If the value of the DueTime parameter is negative, the expiration time is relative to the current system time. Otherwise, the expiration time is absolute. The expiration time is expressed in system time units (100-nanosecond intervals). Absolute expiration times track any changes in the system time; relative expiration times are not affected by system time changes.
Pointer to a DPC object that was initialized by KeInitializeDpc. This parameter is optional.
If the timer object was already in the system timer queue, KeSetTimer returns TRUE.
The KeSetTimer routine does the following:
Computes the expiration time.
Sets the timer to a not-signaled state.
Inserts the timer object in the system timer queue.
If the Dpc parameter is specified, a DPC object is associated with the timer object. When the timer expires, the timer object is removed from the system timer queue and its state is set to signaled. If a DPC object was associated with the timer when it was set, the DPC object is inserted in the system DPC queue to be executed as soon as conditions permit after the timer interval expires.
Expiration times are measured relative to the system clock, and the accuracy with which the operating system can detect when a timer expires is limited by the granularity of the system clock. For more information, see Timer Accuracy.
Only one instantiation of a given DPC object can be queued at any given moment. To avoid potential race conditions, the DPC passed to KeSetTimer should not be passed to KeInsertQueueDpc.
Callers of KeSetTimer can specify one expiration time for a timer. To set a recurring timer use KeSetTimerEx.
For more information about timer objects, see Timer Objects and DPCs.
|Windows version||Available starting with Windows 2000.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|DDI compliance rules||IrqlKeDispatchLte, HwStorPortProhibitedDDIs|