When building drivers in Windows one of the first technical choices you will make is which driver model to use.
Over the years, Microsoft has introduced several models, each with different trade-offs between control, complexity, and ease of use.
This article provides a clear overview of the major driver models: WDM
, KMDF
, and UMDF
, and helps us decide which model is right for our project.
What is a Driver Model?
A driver model is a framework or specification that defines:
- How drivers interact with the Windows OS
- How drivers respond to I/O requested (IRPs)
- What APIs and design patterns are available
Different models exist to accommodate different device types, development styles, and risk levels (e.g., kernel-mode vs user-mode).
1 WDM – Windows Driver Model (Legacy)
Introduced with Windows 98/2000, WDM
is the base-level model that all other models are built upon.
Key Characteristics:
- Very low-level, requires direct handling of IRPs
- No abstraction – the developer must manage memory, IRQLs, synchronization manually
- Can be powerful yet very error-prone
- Supported for legacy drivers, but not recommended for new development
Use If:
- You are maintaining or porting an older WDM driver
- You need extremely low-level control and are willing to manage complexity
Avoid If:
- You are writing a new driver and want modern abstractions and safety features.
2 KMDF – Kernel-Mode Driver Framework (Recommended)
KMDF
is Microsoft's modern driver model built on top of WDM. It simplifies development while still providing full access to kernel-mode capabilities.
Key Characteristics:
- Abstracts away much of the complexity of WDM
- Provides automatic request queueing, Plug and Play, Power management support
- Encourages modular, event-driven architecture (
EvtDeviceAdd
,EvtIoRead
, etc.) - Can still dip down into WDM when needed.
Use If:
- You are writing a kernel-mode driver for a PCI/USB device, filter driver, or virtual device
- You want to write safe and maintainable drivers without reinventing the wheel
Avoid If:
- Your hardware only supports user-mode drivers (or regulatory requirement demand UMDF)
3 UMDF – User-Mode Driver Framework
UMDF
is designed for writing user-mode drivers – safer but less powerful than kernel-mode drivers.
Key Characteristics:
- Runs in user mode – crashes won't crash the system
- Ideal for USB peripheral, sensors, or devices that don't require high-speed I/O
- Easier to develop and debug
- Limited access to hardware; can't handle interrupt-driven devices
Use If:
- You are writing a driver for HID, USB, or sensor devices
- You need high reliability but not high performance
- You want to avoid kernel-mode complexity and risk
Avoid If:
- You need low-latency or interrupt-level access
- Your device operates outside of user-mode compatibility
Driver Model Comparison Table
Feature | WDM | KMDF | UMDF |
---|---|---|---|
Mode | Kernel | Kernel | User |
Level of Abstraction | Low | Medium-High | High |
Performance | High | High | Medium |
Complexity | Very High | Moderate | Low |
Debugging Difficulty | High | Moderate | Low |
Recommended for New Dev? | ❌ | ✅ | ✅ (specific use) |
Leave a comment
Your email address will not be published. Required fields are marked *