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)' > '$(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:
- Why don't Visual Studio developers let us build drivers for Windows 7 if everything works?
- 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.
CodePudding user response:
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.
CodePudding user response:
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.