Windows NT exports two system-specific runtime libraries, which contain functions that begin with the prefix Rtl. NT drivers can use the same kernel-mode RtlXxx routines that the executive components do, but NT drivers cannot call user-mode RtlXxx routines because NT drivers always run in kernel mode. NT file system drivers can also call the system-supplied file system runtime library's FsRtlXxx routines.
Each executive component exports a set of kernel-mode support routines that NT drivers and all other kernel-mode components call. If the underlying implementation of such a support routine changes over time, its callers remain portable because the interface to the defining component does not change.
The NT kernel does not support performing floating-point operations in kernel mode code. A kernel-mode driver cannot do floating-point operations without causing a system crash.
Most NT components are coded entirely in C, with only small pieces of the HAL and Kernel written in assembly language, so that Windows NT is readily portable across CISC- and RISC-based platforms. An NT driver should also be written in C so that it can be recompiled with an system-compatible C compiler, relinked, and run on different Windows NT platforms without recoding parts of the driver or replacing modules in the driver.
Driver writers should not use the features of any particular system-compatible C compiler or C support library if they cannot assume that the same features will be supported by other system-compatible compilers. In general, NT driver writers should write code conforming to the ANSI C standard but avoid writing code with dependencies on anything this standard describes as "implementation defined."
In particular, NT driver writers must avoid the following:
·Dependencies on data types whose size or layout can vary from one platform to another
·Calling any standard C runtime library function that maintains state
·Calling any other standard C runtime library function for which NT provides an alternative function
The DDK supplies a set of include files defining NT-specific data types and constants that drivers (and all other NT kernel-mode components) use to help maintain portability from one NT platform to another. Most NT drivers include the master DDK kernel-mode include file, ntddk.h, which pulls in both ntdef.h for these basic NT types and appropriate selections from a processor-architecture-specific include file when each driver is compiled with the corresponding compiler directive. Note that i386.h covers Intel 80386-based and subsequent x86-based Windows NT platforms, while the header files for RISC processors also can cover a family of microprocessors.
NT driver writers should isolate any platform-dependent definitions within #ifdef statements, so that each driver can be compiled and linked for the appropriate CISC-based or RISC-based Windows NT platform.
Certain NT drivers include other system-supplied header files to maintain portability across Windows NT platforms, in particular, SCSI and video miniport drivers. For more information about the header files for these types of NT drivers, see Appendix A and the Graphics Driver Design Guide, respectively.