This function cancels a preceding call to the NdisMSetPeriodicTimer function or cancels the preceding call to the NdisMSetTimer function if the interval specified to NdisMSetTimer has not yet expired.

VOID NdisMCancelTimer(
  PBOOLEAN TimerCanceled


  • Timer
    [in] Pointer to a timer object, already initialized with the NdisMInitializeTimer function and set with the NdisMSetPeriodicTimer or the NdisMSetTimer function.
  • TimerCanceled
    [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 Values



All Network Driver Interface Specification (NDIS) 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, thus associating a driver-supplied MiniportTimer function with the timer object. MiniportInitialize must call NdisMInitializeTimer before the driver passes the Timer pointer to any other NDIS timer function.

If the NIC does not generate interrupts, the NIC driver has a polling MiniportTimer function to monitor the NIC state for incoming receives and for send completions.

Calls to the NdisMSetXXXTimer functions insert the timer object in the system timer queue. Calls to this function de-queue the timer object if it is currently queued. Only one instantiation of a particular timer object can be queued at any moment.

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

A subsequent call to NdisMSetTimer or NdisMSetPeriodicTimer re-queues the timer object so that the MiniportTimer function runs again when the specified interval expires.

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

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


OS Versions: Windows CE .NET 4.0 and later.
Header: Ndis.h.
Link Library: Ndis.dll.

See Also

MiniportInitialize | MiniportTimer | NdisMInitializeTimer | NdisMSetPeriodicTimer | NdisMSetTimer

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.