In order to make it easy for developers to write drivers for Windows, Microsoft yesterday released an open source framework Driver Module Framework (DMF). This new framework will allow developers to write simple and structured Windows Driver Framework (WDF) drivers and share code amongst drivers.
When developing drivers for Surface devices, Microsoft Devices team developed this framework for internal use. Microsoft is now releasing it as open source to help other OEMs in developing and maintaining quality drivers with maximum efficiency and maintainability. Microsoft also explained some key differences between a traditional WDF and this new DMF-based WDF driver, find them below.
- WDF communicates with DMF, while DMF communicates with the driver.
- The device context (shown in green) exists independently in each Module and in the client driver-specific code. Each smaller device context holds only the elements that are needed for that Module. No Module can access another Module’s device context.
- The WDF callbacks (shown in red) now exist independently in each Module and in the client-specific code. WDF calls into the client driver. DMF intercepts that call and dispatches it to each Module in the tree of instantiated Modules. Each Module handles each callback as it sees fit. Finally, DMF dispatches the callbacks to the client driver’s callbacks.
- Finally, note the arrows. The arrows specifically show the flow among Modules and the client-specific code. In this example, client-specific code can only communicate with three Modules: ACPI, Button, and Stream. It cannot communicate with GPIO, FIFO, List, or Thread. ACPI cannot communicate with FIFO, etc. Even without looking at source code, we have a good idea of how data flows in this driver.
Learn more about this announcement from the source link below.