Krio
Krio

Reputation: 39

Why does the latest WDK not support Windows 7 by default?

I downloaded driver which targets Windows 7 (has option "TargetVersion" == "Windows 7" in ".vcxproj"). Also I installed Visual Studio 2022 Community, the latest SDK and DDK (for Windows 11) to compile it.

When I press "Build solution", I get error:

Windows7 is not a supported OS Version

I'm going to open file:

C:\Program Files (x86)\Windows Kits\10\build\10.0.22621.0\WindowsDriver.Common.targets

and comment the following line:

<Error Text=" '$(TargetVersion)' is not a supported OS Version"
           Condition="'$(WindowsTargetPlatformVersion)' &gt; '$(TargetPlatformVersion_CO)' and '$(TargetVersion)' !='$(LatestTargetVersion)' " />

Then trying to compile again.. and voila - everything works. Meaning driver works well for all operation systems up to Windows 10.

I do understand I'm doing wrong. So, my questions are:

  1. Why don't Visual Studio developers let us build drivers for Windows 7 if everything works?
  2. What is the correct way to build drivers for all operating systems, starting with Windows 7?

Added later:

I think maybe, for example, latest WDK has more API functions which are missing in Windows 7. It turns out that if we code carefully, checking all calls for compatibility, then there should be no problems with compilation.

Upvotes: 1

Views: 5198

Answers (4)

Turto05968
Turto05968

Reputation: 1

You can change settings of WindowsDriver.Common.targets if doesn't work downgrade WDK. Just remove there: <!-- Error out if drivers are targeting OS Version lower than 10 --> <Error Text=" '$(TargetVersion)' is not a supported OS Version" Condition="'$(WindowsTargetPlatformVersion)' &gt; '$(TargetPlatformVersion_CO)' and '$(TargetVersion)' !='$(LatestTargetVersion)' " />

Upvotes: 0

Flavio
Flavio

Reputation: 461

According to this page:

In May of 2022, Microsoft released a version of the Windows Driver Kit (WDK) that supports Visual Studio (VS) 2022. This version is referred to as the Windows 11 Version 22H2 WDK. This new version of the WDK is only supported on VS 2022. It cannot be used with VS 2019.

There are a few bad surprises lurking in this most recent WDK release. Specifically:

  • No support for building drivers that target any Windows version before Windows 10. This means that it’s no longer possible to use the latest WDK to build drivers that support Windows 7 or Windows 8, or Windows 8.1.
  • No support for building 32-bit drivers, for any platform, x86 or ARM, or for any OS version including 32-bit Windows 10.

Microsoft would have us continue to use the “old” Windows 11 WDK hosted on VS 2019 to build drivers for the platforms that are no longer supported. Microsoft assures us that “side by side” (SxS) installation of the VS 2019 and the old Windows 11 WDK and VS 2022 and the new Windows 11 22H2 works, and is supported.

Possible solutions:

  • Do you have technical reasons why you need to use VS 2022? Other projects that require VS 2022? Do you lust for the new VS 2022 features? If so, and you still need to support 32-bit or Win7/Win8/win8.1 targets, you’re going to need to live with a SxS install of VS 2019 and VS 2022 and the most recent versions of their associated WDKs.
  • Or, do you still need to support Win7/Win8/Win8.1 and 32-bit targets, but you can forgo updating to the latest and greatest version of VS? In this case, you can just continue to live with VS 2019 and the older WDK.
  • Consider upgrading your VS development environment (and WDK) to VS 2022 and the 22H2 WDK, and building your drivers for 32-bit or down-level OS versions using the Enterprise WDK (EWDK). This option leaves relieves you of any potential problems maintaining a SxS VS/WDK environment might bring. The only “cost” in terms of usability is that the Enterprise WDK only allows you to build from the command line.

Upvotes: 0

ivan.ukr
ivan.ukr

Reputation: 3551

Question #1 - you better ask Microsoft. Question #2 - you can install multiple SDK and WDK versions side by side. To target Windows 7, install Windows 8.1 SDK and WDK.

Upvotes: 2

Onorio Catenacci
Onorio Catenacci

Reputation: 15303

Per this page:

To target Windows 8.1, Windows 8, and Windows 7, you will need to install an older WDK and an older version of Visual Studio either on the same machine or on a separate machine. For links to older kits, see Other WDK downloads.

Upvotes: 2

Related Questions