Ronald D. Reeves, Ph.D., author of Windows 7 Device Driver, discusses the Kernel Mode Driver Framework (KMDF), which is one of the major frameworks supplied by Microsoft to make the driver writer’s life much easier.

Like this article? We recommend

Like this article? We recommend

The Kernel Mode Driver Framework (KMDF) is the second of two major sub-frameworks in the Windows Driver Foundation (WDF) Framework. KMDF is an infrastructure for developing kernel mode drivers. It provides a C-language device-driver interface (DDI) and can be used to create drivers for Windows 7. In essence, the framework is a skeletal device driver that can be customized for specific devices. KMDF implements code to handle common driver requirements; drivers customize the framework by setting object properties, registering callbacks to be notified of important events, and including code only for features that are unique to their device.

KMDF provides a well-defined object model and controls the lifetime of objects and memory allocations. Objects are organized hierarchically in a parent/child model, and important driver data structures are maintained by KMDF rather than by the driver. This article provides an introduction to the architecture and features of KMDF and to the requirements for drivers that use KMDF (sometimes called KMDF-based drivers or simply KMDF drivers). As I've pointed out in previous articles, if your device doesn't handle interrupts, perform direct memory access (DMA), or require other kernel mode resources such as non-paged pool memory, you should consider writing a user mode driver (UMDF) instead.

KMDF-Supported Devices

KMDF was designed to replace the Windows Driver Model (WDM). The initial KMDF release supports most of the same devices and device classes as WDM does, except those that are currently supported by miniport models. Table 1 lists the device and driver types that KMDF supports.

In general, KMDF supports drivers that conform to WDM, supply entry points for the major I/O dispatch routines, and handle I/O request packets (IRPs). For some device types, device class and port drivers supply driver-dispatch functions and call back to a miniport driver to handle specific I/O details. Such miniport drivers are essentially callback libraries and aren't currently supported by KMDF. In addition, KMDF doesn't support device types that use the Windows imaging architecture (WIA).