Intermediate Drivers

The NDIS architecture supports intermediate drivers. An NDIS intermediate driver does not use NDIS functions to control adapter hardware. Instead, it exists on top of another driver, such as the serial driver. The layered driver model represents a special kind of intermediate driver that exists on top of an NDIS miniport driver. A layered miniport driver exposes a miniport interface to the overlying protocol driver and a protocol-driver interface to the underlying miniport. In a layered miniport driver structure, the protocol driver communicates with a miniport driver at the bottom of the layered miniport driver. A layered miniport driver exports MiniportXXX functions at its upper edge and ProtocolXXX functions at its lower edge.

The following illustration shows the layered NDIS miniport driver architecture.

Layered miniport drivers can be used to filter out certain packets or to perform other special functions, such as decrypting and encrypting data.

A layered miniport driver maintains two interfaces: a miniport driver interface supplied to protocol drivers and a protocol driver interface supplied to underlying miniports. Use the NDIS protocol driver guidelines when building the layered miniport's protocol driver interface. Use the NDIS miniport driver guidelines when building the layered miniport's miniport driver interface; however, the layered miniport will generally use the intermediate driver functions, NdisIMXXX, and not the standard miniport functions, NdisMXXX.

The following table shows a set of new NDIS library functions. These functions apply to intermediate drivers, as well as to layered miniport driver architectures.

Function Description
NdisIMRegisterLayeredMiniport Registers an intermediate driver's MiniportXXX entry points and name with the NDIS library when the driver initializes.
NdisIMInitializeDeviceInstance Calls an NDIS intermediate driver's MiniportInitialize function to set up the driver's virtual network adapter for I/O operations on an underlying network adapter driver to which the intermediate driver is bound.
NdisIMInitializeDeviceInstanceEx Calls an NDIS intermediate driver's MiniportInitialize function to initialize the driver's virtual network adapter and, optionally, to set up state information about the driver's virtual network adapter for subsequently bound protocols.
NdisIMDeInitializeDeviceInstance Calls an NDIS intermediate driver's MiniportHalt function to tear down the driver's virtual network adapter.
NdisIMGetDeviceContext Allows an NDIS intermediate driver's MiniportInitialize function to access the device context area that is allocated by its ProtocolBindAdapter function.

Any NDIS intermediate or layered miniport driver that exports both MiniportXXX and ProtocolXXX functions usually sets up a characteristics structure and calls the NdisIMRegisterLayeredMiniport function from its DriverEntry function after DriverEntry calls the NdisMInitializeWrapper function. This structure is copied in the NdisIMRegisterLayeredMiniport request to the internal storage of the NDIS library. Thus, once it has registered, such a driver cannot change its handler functions. An intermediate driver can call the NdisMRegisterMiniport function, instead of the NdisIMRegisterLayeredMiniport function, if it is prepared for an immediate call to the MiniportInitialize function.

See Also

Miniports, Intermediate Drivers, and Protocol Drivers | NDIS Driver Upper-Edge Functions | NDIS Protocol Driver Lower-Edge Functions

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.