Building Drivers for Previous OS Releases Using the Latest Windows Driver Kit (WDK)



 Windows Driver Developer Blog:

The Windows Driver Kit (WDK) is an essential tool for driver developers, providing the necessary headers, libraries, and tools to build drivers for Windows. With each major OS release, the WDK is updated to include the latest Driver Model DDIs and APIs that support the latest innovations across device classes and fixes for previously released OS versions. This means that with the latest WDK, developers can build drivers not only for the current OS version but also for down-level supported OSes. One of the key advantages of this approach is that it allows developers to build drivers for both current and previous OS releases while benefiting from the latest security and other updates, enhancements and fixes.

Previously it had been a pain point for the driver community to upgrade to the latest WDKs and to manage Side by Side installations as they wanted to build for specific versions. With WDK NuGets it is now seamless to get the headers, libs and build tools for both SDK and WDK and to upgrade to newer versions directly from the Visual Studio, follow Install the WDK using NuGet - Windows drivers for more information.

Building a driver that targets a down-level supported OS version is straightforward and fully supported by Microsoft. Developers need to set the _NT_TARGET_VERSION property corresponding to the target OS, also provided in appendix A. This property can be set in Visual Studio or directly in the vcxproj file. By default this property is set to target the latest version of the OS so if a driver needs to target latest OS version there is no need to change this property.

Setting _NT_TARGET_VERSION in Visual Studio with WDK extension

To build drivers for a specific OS version using Visual Studio, follow these steps:
  1. Open your driver project in Visual Studio.
  2. Right-click on the driver project in the Solution Explorer and select "Properties".
  3. Navigate to "Driver Settings" under "Configuration Properties".
  4. Set the _NT_TARGET_VERSION to the desired OS version.
Here's a visual snippet to guide you through the process:

bS00Mzc0OTEwLWxqb2ZoaA


Setting _NT_TARGET_VERSION in the vcxproj File

If you prefer not to use Visual Studio, you can manually set the _NT_TARGET_VERSION in the vcxproj file. This can be done by adding the following line under the appropriate PropertyGroup for the platform and configuration you need to build for:

<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <_NT_TARGET_VERSION>Desired OS version</_NT_TARGET_VERSION> </PropertyGroup>

Example

For example, to target Windows 10, version 1903, you would set _NT_TARGET_VERSION to 0x0A00:

<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <_NT_TARGET_VERSION>0x0A00</_NT_TARGET_VERSION> </PropertyGroup>

Conclusion

By leveraging the latest WDK, driver developers can ensure their drivers are up-to-date with the latest security patches and improvements in the driver model headers and libs while maintaining compatibility with previous OS versions. Whether using Visual Studio or editing the vcxproj file directly, setting the _NT_TARGET_VERSION is a straightforward process that enhances the flexibility and reliability of driver development. As the development environment evolves with updated APIs, compilers, and linkers, it's an exciting opportunity to ensure that the rebuilt drivers perform optimally. Thorough testing of the drivers will help us adapt to these changes and maintain high standards of functionality and reliability.

Limitations

Microsoft suspended the support for x86 and ARM32 kernel mode components starting Windows 10.0.22000, so latest WDK will not support building x86 and ARM32 kernel mode components.

Microsoft stopped support for building drivers for Windows 7,8 and 8.1 as they are out of support, hence starting Windows 10.0.22621.0 developers can’t use latest WDK to build drivers targeting Windows 7, 8, 8.1.


 Source:

 
Back
Top Bottom