NtSetTimer - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTEXAPI_H
#if (PHNT_MODE != PHNT_MODE_KERNEL)

/**
 * The NtSetTimer routine sets a timer object to the signaled state after a specified interval.
 *
 * \param TimerHandle A handle to the timer object.
 * \param DueTime A pointer to a LARGE_INTEGER that specifies the absolute or relative time at which the timer is to be set to the signaled state.
 * \param TimerApcRoutine An optional pointer to a function to be called when the timer is signaled.
 * \param TimerContext An optional pointer to a context to be passed to the APC routine.
 * \param ResumeTimer If TRUE, resumes the timer; otherwise, sets a new timer.
 * \param Period The period of the timer, in milliseconds. If zero, the timer is signaled once.
 * \param PreviousState A pointer to a variable that receives the previous state of the timer.
 * \return NTSTATUS Successful or errant status.
 */
NTSYSCALLAPI
NTSTATUS
NTAPI
NtSetTimer(
    _In_ HANDLE TimerHandle,
    _In_ PLARGE_INTEGER DueTime,
    _In_opt_ PTIMER_APC_ROUTINE TimerApcRoutine,
    _In_opt_ PVOID TimerContext,
    _In_ BOOLEAN ResumeTimer,
    _In_opt_ LONG Period,
    _Out_opt_ PBOOLEAN PreviousState
    );

#endif
#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwSetTimer(
    _In_ HANDLE TimerHandle,
    _In_ PLARGE_INTEGER DueTime,
    _In_opt_ PTIMER_APC_ROUTINE TimerApcRoutine,
    _In_opt_ PVOID TimerContext,
    _In_ BOOLEAN ResumeTimer,
    _In_opt_ LONG Period,
    _Out_opt_ PBOOLEAN PreviousState
    );

#endif

View code on GitHub

NtDoc

No description available.

NTinternals.net (undocumented.ntinternals.net)

TimerHandle

HANDLE to Timer Object opened with TIMER_MODIFY_STATE access.

DueTime

Time when timer should be set, in 100ns units. If it is negative value, it means relative time.

TimerApcRoutine

User's APC routine, defined as follows:

typedef void (*PTIMER_APC_ROUTINE)(
        IN PVOID TimerContext,
        IN ULONG TimerLowValue,
        IN LONG TimerHighValue
        );

TimerContext

Optional parameter to TimerApcRoutine.

ResumeTimer

If set, Power Management restores system to normal mode when timer is signaled.

Period

If zero, timer is set only once. Else will be set periodic in time intervals defined in Period value (in 100ms units).

PreviousState

Optional pointer to value receiving state of Timer Object before NtSetTimer call.

Documented by

See also