Tue. Jan 28th, 2020

Microsoft open source Driver Module Framework

2 min read

To make it easier for developers to write drivers for Windows, Microsoft released an open source driver module framework (DMF) yesterday. This new framework will allow developers to write structured and straightforward Windows Driver Framework (WDF) drivers and share code between drivers.

When developing drivers for Surface devices, the Microsoft Devices team developed this framework for internal use. Microsoft is now releasing it as an open source to help other OEMs build and maintain high-quality drivers with maximum efficiency and maintainability. Microsoft also explained some of the significant differences between traditional WDF and this new DMF-based WDF driver.

Driver Module Framework

The difference is that the device context (shown in green) exists independently in each module and client driver-specific code. Each smaller device context contains only the elements required by the module. No module can access the device context of another module; WDF callbacks (shown in red) now exist independently in each module and client-specific code. WDF calls the client driver. DMF intercepts the call and dispatches it to each module in the instantiated module tree; each module processes each callback as it sees fit. Finally, the DMF dispatches the callback to the callback of the client driver.

Finally, please pay attention to the arrows. The arrow shows the flow between the module and the client-specific code explicitly. In this example, the client-specific code can only communicate with three modules: ACPI, Button, and Stream. It cannot interact with GPIOs, FIFOs, lists or threads. ACPI cannot communicate with FIFOs and the like. Even without looking at the source code, we know how the data flows through this driver.