Windows Driver Developers Get Open-Source Driver Module Framework

The open-source framework now allows developers to share their code among different drivers for use with a wide range of Windows devices.

Microsoft

Microsoft has announced a new open-source Driver Module Framework (DMF) that developers can use to create drivers for Windows devices while also allowing them to reuse their code for other drivers without having to start from scratch.

The DMF, which was unveiled in an Aug. 15 post on the Microsoft Windows Blogs, still allows device driver developers to create drivers the previous way using the Windows Driver Framework (WDF).  

In the past, Microsoft device designers built a wide range of hardware, including Surface laptops, that used different components, each requiring its own drivers and firmware, according to the post. That meant that individual product teams worked separately on drivers and code to meet their project needs, which ultimately led to tremendous duplication of code and maintenance overhead, according to Microsoft. Worse, with all of those developers of various experience levels working separately, code was sometimes created that lacked the necessary structure and quality.

To reverse these trends, the Surface team began three years ago to take a holistic look at the old processes so they could be improved and allow the reuse of driver code for efficiency and improved quality.

"We started by breaking down individual functionalities in drivers into a shareable code base," the post states. "This iterative effort led to the creation of DMF: an extension to WDF that provides you with a library of new WDF Objects called DMF Modules. Modules allow interaction with one another, WDF, and hardware in a structured manner."

Under the new process, all WDF drivers created by the Microsoft device team are written by using DMF, with well-tested modules that can be reused or extended later to meet new requirements. This process also makes bug fixes more efficient, the post continued, with any bug fix in a module being automatically applied to all the drivers that were built using the module.

The project is open source so many modules have been shared to provide known fixes for commonly faced problems, the post states.

The DMF and its modules, templates and sample code have been shared for public use and are available on the GitHub repository.

"DMF has been designed with the goal to develop and maintain quality drivers with maximum efficiency and maintainability," the post states. "It's now being shared to the world as open source so the Windows ecosystem can leverage this framework and utility-modules to write quality drivers. WDF over a decade ago brought tremendous improvement over WDM and changed the driver landscape, however it has not provided an ability for a 3rd party driver house to create extensions/libraries that plug seamlessly into the WDF messaging model and can be shared across drivers."

The DMF framework follows the design and interaction patterns of WDF but does not replace the older WDF framework. DMF also does not restrict the driver from using operating system interfaces directly. By using DMF, developers can more easily break down the tasks that a device driver must perform into smaller units, which can then be written as modules to perform a single task.

Each module is a self-contained single unit, with its own code, context and callbacks, which makes the code easy to reuse and helps solve many driver problems.