We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5353 - SDL_JOYSTICK_WGI mistakenly included when using Windows SDK 8.1
Summary: SDL_JOYSTICK_WGI mistakenly included when using Windows SDK 8.1
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.1
Hardware: x86 Windows 10
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-14 17:40 UTC by trussell.phone
Modified: 2020-11-27 11:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description trussell.phone 2020-11-14 17:40:32 UTC
The SDL_config_windows.h file (line ~205) mistakenly only uses the compiler version flag (_MSC_VER >= 1911) to decide whether to include SDL_JOYSTICK_WGI.

#if _MSC_VER >= 1911
#define SDL_JOYSTICK_WGI    1   /* This requires Windows SDK 10.0.16299.0 or newer */
#endif

What it should be doing is also checking for the Windows SDK version.  _WIN32_WINNT changes with the SDK version.

The following change works for me:


#include <sdkddkver.h>
#if (_MSC_VER >= 1911) && (_WIN32_WINNT >= 0x0A00)
#define SDL_JOYSTICK_WGI    1   /* This requires Windows SDK 10.0.16299.0 or newer */
#endif


The exact value of the (_WIN32_WINNT >= 0x0A00) might be different as I only have Windows SDK 8.1 and 10.0.17134.0 to test with.

Kind regards,
Terence
Comment 1 trussell.phone 2020-11-14 17:50:24 UTC
I should have mentioned ... my motivation for using Windows SDK 8.1 and VisualStudio 2017 is to target Windows 7.

Not sure if it matters, I'm also using the "Visual Studio 2017 (v141)" Platform Toolset.
Comment 2 Sam Lantinga 2020-11-26 00:35:41 UTC
We can't include sdkddkver.h in that header, as it's not available in every Windows build environment.

That seems like a fine change to make locally though!

Thanks,
Comment 3 Sam Lantinga 2020-11-26 00:51:42 UTC
Actually, I think once we verify the version of Visual Studio we can include that header.

Thanks! I think this works:
https://hg.libsdl.org/SDL/rev/64754dd5b541
Comment 4 trussell.phone 2020-11-26 04:37:00 UTC
That seems good. Thanks for the update!
Comment 5 Sam Lantinga 2020-11-27 11:40:57 UTC
You're welcome!