共用方式為


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

NdisSetTimer sets a timer object to fire after a specified interval, thereby running an associated timer function after the timer fires.

Syntax

VOID NdisSetTimer(
  _In_ PNDIS_TIMER Timer,
  _In_ UINT        MillisecondsToDelay
);

Parameters

  • Timer [in]
    Pointer to caller-supplied resident storage for a timer object previously initialized with NdisInitializeTimer.

  • MillisecondsToDelay [in]
    Specifies the interval, in milliseconds, to elapse before NdisSetTimer calls the associated timer function.

Return value

None

Remarks

NdisSetTimer causes the driver-supplied timer function to run once after the given MillisecondsToDelay expires. This timer function becomes associated with the timer object after the protocol driver calls NdisInitializeTimer. Execution of this timer function is episodic, rather than periodic. A protocol must call NdisSetTimer each time the associated timer function should be run.

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

VOID 
  (*PNDIS_TIMER_FUNCTION)(
    IN PVOID SystemSpecific1,
    IN PVOID FunctionContext,
    IN PVOID SystemSpecific2,
    IN PVOID SystemSpecific3
    );

If a protocol calls NdisSetTimer or the NdisCancelTimer function with the same Timer pointer that was originally passed to another NdisSetTimer call before the originally specified MillisecondsToDelay has expired, the current call cancels the protocol's preceding call to NdisSetTimer. Any call to NdisSetTimer resets the given timer to expire at the interval specified in the most recent call and causes the associated timer function to run when the most recently specified interval has expired.

Timer resolution on the host varies. Consequently, calling NdisSetTimer with small time-interval values does not necessarily cause the execution of the timer function to occur exactly when the specified interval expires. The minimum practicable interval to specify on Windows 2000 and later platforms is ten milliseconds.

Requirements

Target platform

Universal

Version

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

Header

Ndis.h (include Ndis.h)

Library

Ndis.lib

IRQL

<= DISPATCH_LEVEL

See also

NdisCancelTimer

NdisInitializeTimer

 

 

Send comments about this topic to Microsoft