Kernel Mode Driver Framework for Windows 7 Drivers
- Kernel Mode Driver Framework for Windows 7 Drivers
- KMDF Components
- KMDF Object Model
- Methods, Properties, and Events
- Object Hierarchy
- Object Attributes
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.
Table 1 Devices and Driver Types Supported by KMDF
Device or Driver Type |
Existing Driver Model |
Comments |
---|---|---|
Control and non–Plug and Play drivers |
Legacy |
Supported |
IEEE 1394 client drivers |
Depends on device class |
Supported for devices that don't conform to existing device class specifications |
ISA, PCI, PCMCIA, and secure digital (SD) devices |
WDM driver |
Supported, if device class or port drivers don't provide the driver dispatch functions |
NDIS protocol drivers |
WDM upper edge and NDIS lower edge |
Supported |
NDIS WDM drivers |
NDIS upper edge and WDM lower edge |
Supported |
Softmodem drivers |
WDM driver with upper-edge support for TAPI interface |
Supported |
Storage class drivers and filter drivers |
WDM driver |
Supported |
Transport driver interface (TDI) client drivers |
Generic WDM driver |
Supported |
USB client drivers |
Depends on device class |
Supported |
Winsock client drivers |
WDM driver with a callback interface for device-specific requests |
Supported |
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).