WIPIVERSE All articles

Kernel-Mode Driver Framework

The Kernel-Mode Driver Framework (KMDF) is a library of functions and a runtime environment developed by Microsoft to facilitate the development of kernel-mode device drivers for the Microsoft Windows operating system. It was first introduced with Windows 2000 (as version 1.0, distributed separately) and integrated into the operating system starting with Windows Vista (version 1.1).

Purpose and Design KMDF was designed to address the complexity and common error patterns associated with writing drivers using the traditional Windows Driver Model (WDM). It provides an object-oriented, event-driven programming model that encapsulates many of the difficult aspects of kernel-mode programming, such as:

  • Power management (handling IRP_MJ_POWER).
  • Plug and Play (PnP) state machines (handling IRP_MJ_PNP).
  • I/O queue management and request cancellation.
  • Synchronization and locking discipline.
  • Memory management and object lifetime tracking.

Architecture Drivers written using KMDF (often called "framework-based drivers") link against the framework library (Wdf01000.sys). The framework acts as a layer between the driver and the Windows I/O Manager. It receives major I/O Request Packets (IRPs) from the I/O Manager, processes the standard boilerplate logic internally, and calls into the driver's event callback routines for device-specific logic.

Version History

  • KMDF 1.0: Released as a redistributable package for Windows 2000, Windows XP, and Windows Server 2003.
  • KMDF 1.1: Included in-box with Windows Vista and Windows Server 2008.
  • KMDF 1.5: Included in-box with Windows 7 and Windows Server 2008 R2.
  • KMDF 1.9: Included in-box with Windows 8 and Windows Server 2012.
  • KMDF 1.11 / 1.13 / 1.15 / 1.17 / 1.19 / 1.21 / 1.23 / 1.25 / 1.27 / 1.29 / 1.31 / 1.33 / 1.35 / 1.37 / 1.39 / 1.41: Subsequent versions shipped with Windows 8.1, Windows 10, and Windows 11 releases, adding features such as support for new power framework (PoFx) capabilities, improved diagnostics, and support for modern hardware features (e.g., DMA version 3, virtualization).

Relationship to Other Models

  • WDM (Windows Driver Model): The lower-level, IRP-based model upon which KMDF is built. KMDF drivers are technically WDM drivers that utilize the framework library.
  • UMDF (User-Mode Driver Framework): A counterpart framework allowing certain driver types (primarily protocol/functional drivers for USB, HID, etc.) to run in user mode for improved system stability.
  • WDF (Windows Driver Foundation): The collective term encompassing both KMDF and UMDF.

Key Benefits

  • Reduced code volume for standard driver infrastructure.
  • Improved driver reliability and security through verified framework handling of complex state machines.
  • Built-in support for Driver Verifier and Static Driver Verifier (SDV) rules.
  • Automatic handling of reference counting for framework objects.
Browse

More topics to explore

    Browse all articles