Microsoft Windows CE 3.0  

Layered NDIS Miniport Drivers

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The NDIS architecture that is implemented in Windows CE also features intermediate drivers. An NDIS intermediate driver does not use NDIS functions to control adapter hardware. Instead, it sits on top of another driver; for example, the serial driver. The "layered" driver model represents a special kind of intermediate driver that sits on top of an NDIS miniport driver. Windows CE 3.0 also supports a layered driver architecture. 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 "talks" to a miniport driver at the bottom of the layered miniport driver. A layered miniport driver exports Miniport Xxxfunctions at its upper edge and Protocol Xxxfunctions at its lower edge.

Layered miniport drivers are used to filter out certain packets or to perform other special functions, such as decryption and encryption of data. To prevent packets from looping back between the protocol driver and the layered miniport driver, the protocol driver must set the NDIS_FLAGS_DONT_LOOPBACK flag by calling the NdisSetPacketFlagsfunction.

A layered miniport driver calls the NdisOpenAdapterfunction to open and establish a binding to an underlying adapter driver or intermediate NDIS driver that exports a set of Miniport Xxxfunctions at its upper edge. A layered miniport driver exports the MiniportSetInformationand MiniportQueryInformationfunctions to process Setand Queryrequests from a higher-level driver, and to pass them on to a lower-level driver.

NdisMXxx functions may be called only when the driver is running in a miniport context. If the function of a layered miniport driver is not in a miniport context, make sure to use the NdisIMSwitchToMiniportfunction before you call any Miniport Xxxfunctions. Use the NdisIMRevertBackfunction to leave the miniport context. All of the miniport handler functions that are registered with NDIS will be called by NDIS within a miniport context.

The following table lists a set of new NDIS library functions that are supported in Windows CE. These functions apply to intermediate drivers, as well as to layered miniport driver architectures.

Function Description
NdisIMRegisterLayeredMiniport Registers an intermediate driver's Miniport Xxxentry points and name with the NDIS library when the driver initializes
NdisIMInitializeDeviceInstance Calls an NDIS intermediate driver's MiniportInitializefunction 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 MiniportInitializefunction 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 MiniportHaltfunction to tear down the driver's virtual network adapter
NdisIMGetDeviceContext Allows an NDIS intermediate driver's MiniportInitializefunction to access the device context area that is allocated by its ProtocolBindAdapterfunction

Any NDIS intermediate or layered miniport driver that exports both Miniport Xxxand Protocol Xxxfunctions usually sets up a characteristics structure and calls the NdisIMRegisterLayeredMiniportfunction from its DriverEntryfunction after DriverEntrycalls the NdisMInitializeWrapperfunction. This structure is copied in the NdisIMRegisterLayeredMiniportrequest 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 NdisMRegisterMiniportfunction, instead of the NdisIMRegisterLayeredMiniportfunction, if it is prepared for an immediate call to the MiniportInitializefunction.

Drivers that call the NdisIMRegisterLayeredMiniportfunction run at IRQL PASSIVE_LEVEL.



 Last updated on Tuesday, July 13, 2004

© 2004 Microsoft Corporation. All rights reserved.