I'm a developper from the FOSS game 0 A.D. (https://play0ad.com) and I recently realised that our detection of the Windows version was failing for Windows 11, just like it did between Windows 8.1 and Windows 10.
It reports Windows 10.0.22000 which is technically the correct version, but we'd like it to report Windows 11 instead.
Here is the current code we use
- https://github.com/0ad/0ad/blob/master/source/lib/sysdep/os/win/wposix/wutsname.cpp#L35
- https://github.com/0ad/0ad/blob/master/source/lib/sysdep/os/win/wversion.cpp
- https://github.com/0ad/0ad/blob/master/source/lib/sysdep/os/win/wversion.h
We're stuck with the Windows 7 SDK for compatibility reasons.
Easy solution would be to replace
if (osInfo.dwMajorVersion >= 10)
{
stream << "Win" << osInfo.dwMajorVersion;
}
by
if (osInfo.dwMajorVersion >= 10)
{
if (osInfo.dwMinorVersion > 22000)
stream << "Win" << 11;
else
stream << "Win" << osInfo.dwMajorVersion;
}
Is there a more robust/future proof solution.
Thanks in advance!