Developing Drivers with the Windows Driver Foundation (Pro Developer)
Serviceability is a common problem for drivers. When Microsoft releases a new version of Windows, driver vendors must test their drivers to ensure that they operate properly on the new release. Any driver that uses undocumented features-or that uses documented features in a nonstandard way-is likely to encounter compatibility problems from one Windows release to the next.
WDF drivers are less susceptible to such problems because Microsoft tests the frameworks on each new version of the operating system. This testing ensures that WDF drivers maintain consistent behavior from one release to the next.
To improve driver serviceability and help to prevent compatibility problems, WDF provides versioning and support for side-by-side operation of different framework major versions. Each release of the framework has a major and minor version number. A WDF driver always uses the major version for which it was built and tested. If a newer major version of the framework is installed, the older version runs side by side with the newer major version and WDF drivers continue to bind to the major version for which they were built.
WDF drivers specify the major and minor version of the framework that they were built for when they are compiled. When the driver is installed, it specifies the version of the framework that must be present on the system to meet the driver's minimum requirements:
-
If the specified major version is not present on the user's system, the WDF co-installer that is included in all WDF installation packages automatically installs the specified major version side by side with any older major versions.
-
If the specified minor version is more recent than the one on the user's system, the WDF co-installer updates the framework to the newer minor version.
The older minor version is backed up, so that users can use System Restore to return to it, if necessary.
When a new minor version is installed on the system, the existing WDF drivers that use the same major version automatically bind to the new minor version. This means that a WDF driver binds to the most recent minor version of the major version against which the driver was compiled. This feature allows WDF drivers to benefit from bug fixes in minor versions.
Tip | Even drivers that comply with WDF rules could be affected by subtle changes between versions of Windows. You should always test your drivers with service pack candidates and new versions of Windows to ensure that there are no problems. Chapter 20, "How to Install WDF Drivers," discusses WDF versioning and installation. |
During the development of Windows 2000 (circa 1998) when I was learning how to write a driver and debug kernel-mode code, I was constantly amazed that the whole system worked. I saw three different levels of complexity in the driver: first, with communicating with its hardware; second, with implementing Plug and Play and power and other operating system requirements; and third, with communicating with other drivers.
It made my head spin, thinking of how hard it was just to get one of these right, let alone implementing each of them and then managing the interaction between these three areas. Even back then, I knew there had to be a better way to develop a driver, but I didn't have the experience or the time to do something about it. So when I heard about the driver frameworks team, I knew I had to work on the team to fix these very issues and make driver writing a simpler task.-Doron Holan, Windows Driver Foundation Team, Microsoft
Категории