Expand Minimize

NdisCancelTimer function

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

NdisCancelTimer cancels the immediately preceding call to NdisSetTimer if the interval given to NdisSetTimer has not yet expired.


VOID NdisCancelTimer(
  _In_   PNDIS_TIMER Timer,
  _Out_  PBOOLEAN TimerCanceled


Timer [in]

Pointer to a timer object, already initialized with NdisInitializeTimer and set with NdisSetTimer.

TimerCanceled [out]

Pointer to a caller-supplied variable. NdisCancelTimer sets this variable to TRUE if the timer was queued and then canceled, or to FALSE if the timer either was not set or has already fired and caused the associated timer function to run.

Return value



All NdisXxxTimer functions operate on an opaque timer object, for which a protocol driver must supply resident storage. The protocol driver must call NdisInitializeTimer with a caller-supplied pointer to this storage, thereby associating a driver-supplied timer function with the timer object. The protocol driver must call NdisInitializeTimer before the driver passes the Timer pointer to any other NdisXxxTimer function.

The following describes the syntax of the driver-supplied timer function:

 IN PVOID SystemSpecific1,
 IN PVOID FunctionContext,
 IN PVOID SystemSpecific2,
 IN PVOID SystemSpecific3

Calls to the NdisSetTimer functions insert the timer object in the system timer queue. During the interval in which the timer object is queued, calls to NdisCancelTimer remove the timer object from the queue, thereby canceling the execution of the associated timer function. Only one instance of a particular timer object can be queued at any given moment.

A subsequent call to NdisSetTimer requeues the timer object so the timer function again will be run when the given interval expires.

A call to NdisCancelTimer returns TRUE in the TimerCanceled parameter if the timer was queued and then canceled. NdisCancelTimer returns FALSE if the timer function is already running or if there is no way to stop the timer function from running. If NdisCancelTimer returns FALSE, the caller must take appropriate action.



Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisCancelTimerObject instead. Supported for NDIS 5.1 drivers in Windows Vista and Windows XP.


Ndis.h (include Ndis.h)



See also




Send comments about this topic to Microsoft

© 2014 Microsoft