Portability (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.

NDIS drivers should be written so that they are easily portable across all platforms that support Microsoft Windows 2000 and later operating systems. In general, porting from one hardware platform to another should only require recompilation with a system-compatible compiler.

Follow these guidelines for writing NDIS drivers:

  • Avoid calling operating system-specific functions; instead, use the NDIS equivalents. NDIS exports a rich set of support functions for writing drivers, and by calling these functions, you can port the code between Microsoft operating systems that support NDIS.

  • Write drivers in C; specifically, the ANSI C Standard. Avoid using any language features that are not supported by other system-compatible compilers. Do not use any features that the ANSI C standard designates as "implementation defined."

  • Avoid dependencies on data types whose size and layout vary across platforms. For example, do not write driver code that calls any C Run-Time Library functions instead of NDIS-provided functions.

  • Do not use floating-point operations in kernel mode. Attempting such operations will result in a fatal error.

  • Use #ifdef and #endif statements to encapsulate code used to support platform-specific features.

 

 

Send comments about this topic to Microsoft