Поделиться через


Implementation Tips and Requirements for WDM Lower Edge (NDIS 5.1)

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.

This topic discusses tips and requirements for implementing an NDIS-WDM miniport driver. Such a miniport driver can call both NDIS and non-NDIS functions. These non-NDIS functions include, for example, WDM-kernel-mode support routines and functions for a particular bus-driver interface.

When implementing an NDIS-WDM miniport driver, the following items should be observed:

  • Building an NDIS-WDM miniport driver requires that the NDIS_WDM flag is defined before the ndis.h header file is included. Defining the NDIS_WDM flag ensures that ndis.h automatically includes the appropriate WDM header file. The NDIS_WDM flag should be either embedded at the start of the miniport driver's source code or set in the miniport driver's sources file. An NDIS-WDM miniport driver requires a WDM header file in order to call kernel-mode routines such as IoCallDriver and IoAllocateIrp.

  • Function calls for a particular bus-driver interface require the header files for that bus driver.

  • Including NDIS and non-NDIS headers in the same source file is not recommended because they might not be compatible. That is, separate source files should be created for code that calls NDIS functions, and for code that calls non-NDIS functions.

  • An NDIS-WDM miniport driver should call appropriate NDIS functions to allocate and release resources unless the NDIS-WDM miniport driver allocates and releases resources as described in either of the following scenarios:

    • a resource, typically a memory resource, is allocated by the NDIS-WDM miniport driver and is later released by a non-NDIS entity such as a bus-driver interface
    • a resource, typically a memory resource, is allocated by a non-NDIS entity and is later released by the NDIS-WDM miniport driver

    For the preceding scenarios, the NDIS-WDM miniport driver should call the appropriate WDM routines to allocate or release resources for the non-NDIS entity.

 

 

Send comments about this topic to Microsoft