MiniportSynchronizeMessageInterrupt routine

A miniport driver provides a MiniportSynchronizeMessageInterrupt handler if any driver function that runs at less than DIRQL shares resources for a message signaled interrupt with the MiniportMessageInterrupt function.

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



BOOLEAN MiniportSynchronizeMessageInterrupt(
  _In_  NDIS_HANDLE SynchronizeContext
{ ... }


SynchronizeContext [in]

A handle to a context area that is supplied when the miniport driver's MiniportXxx or internal function called the NdisMSynchronizeWithInterruptEx function.

Return value

MiniportSynchronizeMessageInterrupt returns a Boolean value with a driver-determined meaning. NDIS returns this same value when NDIS returns from NdisMSynchronizeWithInterruptEx.


If any miniport driver function that runs at less than DIRQL shares resources, such as NIC registers, with the driver's MiniportMessageInterrupt function, that driver cannot access those resources directly. If such a lower priority function attempts to access the shared resources directly, it might be preempted by MiniportMessageInterrupt, which could override the state changes of the lower priority driver function.

To synchronize access to shared resources with MiniportMessageInterrupt, lower priority driver functions must call the NdisMSynchronizeWithInterruptEx function. The driver's MiniportSynchronizeMessageInterrupt function accesses the shared resources at DIRQL. Calling NdisMSynchronizeWithInterruptEx prevents race conditions and deadlocks in such a miniport driver.

Any lower priority driver functions that share resources among themselves (but not with any function that runs at DIRQL) should use a spin lock to protect those shared resources.

MiniportSynchronizeMessageInterrupt runs at the DIRQL assigned when the driver's MiniportInitializeEx function calls the NdisMRegisterInterruptEx function. Like any driver function that runs at DIRQL, MiniportSynchronizeMessageInterrupt should return control back to the caller as quickly as possible, and it can call only those NdisXxx functions that are safe to call at any IRQL.


To define a MiniportSynchronizeMessageInterrupt 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 MiniportSynchronizeMessageInterrupt function that is named "MySynchronizeMessageInterrupt", use the MINIPORT_SYNCHRONIZE_MESSAGE_INTERRUPT type as shown in this code example:


Then, implement your function as follows:

    NDIS_HANDLE  SynchronizeContext

The MINIPORT_SYNCHRONIZE_MESSAGE_INTERRUPT 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 MINIPORT_SYNCHRONIZE_MESSAGE_INTERRUPT 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.



Supported in NDIS 6.0 and later.


Ndis.h (include Ndis.h)


See Remarks section

See also




Send comments about this topic to Microsoft

© 2014 Microsoft