NDIS_TIMER_FUNCTION callback function

The NdisTimerFunction callback function is called by NDIS after a driver sets a one-shot or periodic timer when a timer fires.

Note  You must declare the function by using the NDIS_TIMER_FUNCTION type. For more information, see the following Examples section.



void NdisTimerFunction(
  PVOID SystemSpecific1,
  PVOID FunctionContext,
  PVOID SystemSpecific2,
  PVOID SystemSpecific3



A pointer to a system-specific value that is reserved for system use.


A pointer to a driver-supplied context area that the driver passed to the NdisSetTimerObject function. If the FunctionContext parameter of NdisSetTimerObject was NULL, NDIS uses the default value that the driver specified in the NDIS_TIMER_CHARACTERISTICS structure. The driver passed the structure to the NdisAllocateTimerObject function to initialize the associated timer object.


A pointer to a system-specific value that is reserved for system use.


A pointer to a system-specific value that is reserved for system use.

Return Value



Any NDIS driver can have one or more NdisTimerFunction callback functions. Each such NdisTimerFunction callback must be associated with a different driver-allocated and initialized timer object.

The driver initializes a driver-allocated timer object by calling the NdisAllocateTimerObject function.

A subsequent call to the NdisSetTimerObject function causes the NdisTimerFunction callback that is associated with the timer object to be run after a specified interval or periodically.

To cancel calls to NdisTimerFunction, call the NdisCancelTimerObject function. NDIS might still call NdisTimerFunction if the timeout has already expired before the call to NdisCancelTimerObject.

If a NdisTimerFunction callback shares resources with other driver functions, the driver should synchronize access to those resources with a spin lock.


To define a NdisTimerFunction function, you must first provide a function declaration that identifies the type of function you're defining. Windows provides a set of function types for drivers. Declaring a function using the function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it's a requirement for writing drivers for the Windows operating system.

For example, to define a NdisTimerFunction function that is named "MyTimerCallback", use the NDIS_TIMER_FUNCTION type as shown in this code example:

Then, implement your function as follows:
    PVOID  SystemSpecific1,
    PVOID  FunctionContext,
    PVOID  SystemSpecific2,
    PVOID  SystemSpecific3
The NDIS_TIMER_FUNCTION function type is defined in the Ndis.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the NDIS_TIMER_FUNCTION function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for NDIS Drivers.

For information about Use_decl_annotations, see Annotating Function Behavior.


Minimum supported client Supported in NDIS 6.0 and later.
Target Platform Windows
Header ndis.h (include Ndis.h)

See Also

Initializing NDIS Timers





Servicing Timers

Setting and Clearing Timers