ExCancelTimer function

The ExCancelTimer routine cancels a timer that was set by a previous call to the ExSetTimer routine.


BOOLEAN ExCancelTimer(
  PEX_TIMER              Timer,



A pointer to an EX_TIMER structure. This structure is a timer object that was previously allocated by the ExAllocateTimer routine.


Drivers must set this parameter to NULL.

Return value

This routine returns TRUE if the timer was canceled. Otherwise, the routine returns FALSE.


After your driver calls the ExSetTimer routine to set the timer, the timer might be canceled before it expires. The driver can call the ExCancelTimer routine to explicitly cancel a pending timer. Also, if the driver calls the ExSetTimer routine to set a new timer on a timer object before a previously set timer on this object expires, this ExSetTimer call implicitly cancels the previous timer and then starts the new timer.

A return value of TRUE indicates that the timer was set when ExCancelTimer was called. In this case, the routine cancels the timer. A return value of FALSE indicates that the timer was not set, which might mean that the timer was never set, that the timer had already been canceled, or that the timer had already expired.

When a timer expires, the operating system signals the timer object. As an option, a driver can supply an ExTimerCallback callback routine that is called when the timer expires. If the driver supplies this callback routine, this routine is guaranteed to be called if the timer object is signaled. If the timer is canceled before it expires, the timer object is not signaled and the callback routine is not called.

For more information, see ExXxxTimer Routines and EX_TIMER Objects.


Minimum supported client Available starting with Windows 8.1.
Target Platform Universal
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)
Library Ntoskrnl.lib

See also