2.1 Portability

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

Driver developers should avoid calling operating system-specific functions since this will make their driver unportable. Instead, the NDIS equivalents of such calls should be used. Restricting support calls to NDIS functions allows the code to be ported between Microsoft operating systems that support NDIS. NDIS exports a rich set of support functions for writing drivers, and it should not be necessary to call the operating system directly.

Drivers should be written in C. Further, driver code should be restricted to the ANSI C standard and should avoid using any language features that are not supported by other system-compatible compilers. Driver code should not be written using any features that the ANSI C standard designates as “implementation defined”.

Drivers should avoid any dependencies on data types whose size and layout vary across platforms. Driver code should not call any C runtime library functions instead of NDIS-provided functions.

No floating point operations are allowed in kernel-mode. It is a fatal error to attempt such operations.

If a driver contains code to support platform-specific features, such code should be encapsulated between #ifdef and #endif statements.