This documentation is archived and is not being maintained.

NdisMCancelTimer 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.

NdisMCancelTimer cancels a preceding call to NdisMSetPeriodicTimer or cancels the immediately preceding call to NdisMSetTimer if the interval given to NdisMSetTimer has not yet expired.


VOID NdisMCancelTimer(
  _Out_ PBOOLEAN             TimerCancelled


Timer [in]

Pointer to a timer object, already initialized with NdisMInitializeTimer and set with NdisMSetPeriodicTimer or NdisMSetTimer.

TimerCancelled [out]

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

Return value



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

Drivers of NICs that do not generate interrupts have a polling MiniportTimer function to monitor the NIC state for incoming receives and for send completions.

Calls to the NdisM..Timer functions insert the timer object in the system timer queue. Calls to NdisMCancelTimer dequeue the timer object if it is currently queued. Only one instantiation of a particular timer object can be queued at any given moment.

A call to NdisMCancelTimer while the timer object designated by Timer is queued removes the timer object from the queue, thereby canceling the execution of the associated MiniportTimer function.

A subsequent call to NdisMSetTimer or NdisMSetPeriodicTimer requeues the timer object so the MiniportTimer function again will be run when the given interval expires.

A call to NdisMCancelTimer can occur just after a timer has fired but before the associated MiniportTimer function is run. Usually, a MiniportTimer function sets a state variable immediately on entry to indicate that it is running. When another miniport driver function calls NdisMCancelTimer, it can check such a TimerCancelled variable on return from this call to determine whether its call to NdisMCancelTimer also canceled execution of the MiniportTimer function.

A call to NdisMCancelTimer while the MiniportTimer function is running has no effect on the execution of MiniportTimer. It continues to run until it returns control.


Target platform



Not supported for NDIS 6.0 drivers in Windows Vista. Use NdisCancelTimerObjectinstead. 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