ExDeleteTimer routine

The ExDeleteTimer routine deletes a timer object that was previously allocated by the ExAllocateTimer routine.


BOOLEAN ExDeleteTimer(
  _In_ PEX_TIMER              Timer,
  _In_ BOOLEAN                Cancel,
  _In_ BOOLEAN                Wait,


Timer [in]

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

Cancel [in]

Whether to cancel the timer if it is currently set. If TRUE, the routine cancels the timer if the timer is set. If FALSE, the routine does not cancel the timer if it is set. If the caller sets Wait to TRUE, Cancel must also be TRUE; otherwise, a bug check occurs.

Wait [in]

Whether to wait for the timer to finish expiring if the timer has already started the process of expiring. If TRUE, the routine waits for the timer to expire. If FALSE, the routine does not wait. For more information, see Remarks.

Parameters [in]

A pointer to an EXT_DELETE_PARAMETERS structure. The calling driver previously called the ExInitializeDeleteTimerParameters routine to initialize this structure.

Return value

This routine returns TRUE if Cancel is TRUE and the timer was canceled. Otherwise, the routine returns FALSE. For more information, see Remarks.


After your driver calls this routine, the timer object pointed to by Timer might no longer be valid. However, the Timer parameter value passed to an ExTimerCallback callback routine, if the driver implements this routine, is always a valid pointer to a timer object.

If Cancel is TRUE, a return value of FALSE indicates that the timer was never set, or that the timer was set but expired before it could be canceled. If Cancel is FALSE, the routine always returns FALSE.

This routine can block if Wait is TRUE. If ExDeleteTimer is called from the driver's ExTimerCallback routine, which is called at DISPATCH_LEVEL, the Wait parameter in this call must be FALSE.

If Wait is TRUE, the routine must be called at IRQL <= APC_LEVEL. If Wait is FALSE, the routine can be called at IRQL <= DISPATCH_LEVEL.

For more information, see Deleting a System-Allocated Timer Object.


Target platform



Available starting with Windows 8.1.


Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)




See Remarks.

See also




Send comments about this topic to Microsoft