驱动中定时

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
NTSTATUS KeWaitForSingleObject(
    IN PVOID Object,
    IN KWAIT_REASON WaitReason,
    IN KPROCESSOR_MODE WaitMode,
    IN BOOLEAN Alertable,
    IN PLARGE_INTEGER Timeout OPTIONAL   // Pointer to a time-out value that specifies the absolute or relative time, in 100 nanosecond units, 
    );


VOID KeStallExecutionProcessor(
    IN ULONG MicroSeconds                    // </em>Specifies the number of microseconds to stall.
    );

BOOLEAN KeSetTimer(
    IN PKTIMER Timer,
    IN LARGE_INTEGER DueTime, // Specifies the absolute or relative time at which the timer is to expire. If the value of the <em>DueTime</em> 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. 
    IN PKDPC Dpc OPTIONAL
    );

为了重复地调用CustomTimerDpc例程,使用KeSetTimerEx来设置定时器,并在Period参数中规定一个再次发生的间隔。除了这个附加的参数,KeSetTimerEx就象KeSetTimer一样。