NtSetTimer(
IN HANDLE TimerHandle
IN PLARGE_INTEGER DueTime
IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL
IN PVOID TimerContext OPTIONAL
IN BOOLEAN WakeTimer
IN LONG Period OPTIONAL
OUT PBOOLEAN PreviousState OPTIONAL
);
ZwSetTimer
ZwSetTimer sets properties of and activates a timer.
NTSYSAPI
NTSTATUS
NTAPI
ZwSetTimer(
IN HANDLE TimerHandle,
IN PLARGE_INTEGER DueTime,
IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL,
IN PVOID TimerContext,
IN BOOLEAN Resume,
IN LONG Period,
OUT PBOOLEAN PreviousState OPTIONAL
);
Parameters
TimerHandle
A handle to a timer object.The handle must grant TIMER_MODIFY_STATE access.
DueTime
Points to a value that specifies the absolute or relative time at which the timer is to be
signaled. A negative value specifies an interval relative to the current time.The value is
expressed in units of 100 nanoseconds. Absolute times track any changes in the system
time; relative times are not affected by system time changes.
TimerApcRoutine
Specifies an optional timer APC routine.The timer APC routine has the following
prototype:
VOID (APIENTRY *PTIMER_APC_ROUTINE)(PVOID TimerContext,
ULONG TimerLowValue,
ULONG TimerHighValue);
TimerContext
A void pointer that will be passed as argument to the timer APC routine.
Resume
Specifies whether to restore a system in suspended power conservation mode when
the timer state is set to signaled.
Period
The period of the timer, in milliseconds. If Period is zero, the timer is signaled once. If
Period is greater than zero, the timer is periodic.
PreviousState
Optionally points to a variable that receives the signal state of the timer.A value of
true means that the timer is signaled.
1996 CH09 11.24.99 09:55 Page 213
214 Synchronization: ZwSetTimer
Return Value
Returns STATUS_SUCCESS, STATUS_TIMER_RESUME_IGNORED or an error status, such as
STATUS_ACCESS_DENIED or STATUS_INVALID_HANDLE.
Related Win32 Functions
SetWaitableTimer.
Remarks
SetWaitableTimer exposes most of the functionality of ZwSetTimer.