What is the difference between a WDM driver, a KMDF driver and a UMDF driver?
Asked Answered
D

2

23

When creating a Windows Driver project in Visual Studio 2012, you have many different options to choose from.

There's a page on MSDN that helps you with choosing the correct driver model for your device. It however doesn't clearly explain the exact differences between the WDM, KMDF and UMDF driver types, and when to choose which model.

I'm looking for an explanation on the differences between the WDM, KMDF and UMDF driver models, so it's easy for beginning Windows driver developers to choose the correct model.

Dumm answered 15/5, 2013 at 15:45 Comment(0)
H
27

In a nutshell:

  • WDM stands for Windows Driver Model. Every Kernel driver is essentially a WDM driver.
  • KMDF stands for Kernel Mode Driver Framework. This is a framework that encapsulates and hides many of the OS programming aspects that driver developer must relate to even if it has nothing to do with the business logic of his driver. Some functionality doesn't exist in KMDF framework and will require native Kernel calls without using the framework (but in most situations it's not the case).
  • UMDF stands for User Mode Driver Framework. It's a complementary framework to KMDF and together they comprise WDF (Windows Driver Frameworks). UMDF allows to create a driver in user mode, having all the benefits of User mode programming vs Kernel mode. Naturally, UMDF driver have limitations compared to KMDF/WDM drivers and in most situations it will require a Kernel counterpart with at least some functionality.

The page you've referenced is pretty comprehensive. You should dwell into it for deeper understanding.

Headliner answered 15/5, 2013 at 16:1 Comment(3)
Thanks for the explanation, but one thing is not fully clear to me yet. You say that every kernel driver is a WDM driver, but are all WDM drivers kernel drivers? Why are WDM and KMDF two different templates in VS2012?Dumm
@Dumm think of it in terms of Win32 and MFC (I hope you're familiar with both). While every MFC program is a Win32 program, not every Win32 program is an MFC program. The KMDF is akin to MFC: a framework that can be used to hide some of the complexity of WDM. So, the templates differ because what they generate is different: one generates one kind of project, and the other generates another kind. To answer your other question, all modern kernel drivers are WDM drivers; although there are other "legacy" kernel driver models, they are not officially supported and should no longer be used.Lindholm
In most situations you do not need a kernel mode driver.Lukewarm
C
17

I like articel from MSDN : Differences Between WDM and KMDF

  • WDM is the driver model since pnp device drivers (>=Win2k). In this model you have to handle functions not relevant to your functionality. Walter Oney (Programming the Microsoft Windows Driver Model) outsourced such functions to external device driver libraries for reusing.

  • WDF/kmdf tries to simplify the development of device drivers. Functions can be overwritten or default handler is used. The administration of memory and queues has been greatly simplified and secured.

  • UMDF tried to use similar function calls in user mode as function calls in kernel mode.

Hopefully not too late. Question date first seen when I had finished writing!

Coom answered 7/11, 2013 at 14:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.