Improve Windows 11 detection.

This commit is contained in:
levlam 2021-10-13 14:01:23 +03:00
parent c3684e1b4a
commit c7ce933520

View File

@ -150,7 +150,9 @@ Slice get_operating_system_version() {
} }
var clientStrings = [ var clientStrings = [
{s:'Windows 10', r:/(Windows 10.0|Windows NT 10.0)/}, {s:'Windows 11', r:/(Windows 11|Windows NT 11)/},
// there is no way to distinguish Windows 10 from newer versions, so report it as just Windows.
// {s:'Windows 10 or later', r:/(Windows 10|Windows NT 10)/},
{s:'Windows 8.1', r:/(Windows 8.1|Windows NT 6.3)/}, {s:'Windows 8.1', r:/(Windows 8.1|Windows NT 6.3)/},
{s:'Windows 8', r:/(Windows 8|Windows NT 6.2)/}, {s:'Windows 8', r:/(Windows 8|Windows NT 6.2)/},
{s:'Windows 7', r:/(Windows 7|Windows NT 6.1)/}, {s:'Windows 7', r:/(Windows 7|Windows NT 6.1)/},
@ -242,7 +244,18 @@ Slice get_operating_system_version() {
if (major == 10) { if (major == 10) {
if (is_server) { if (is_server) {
return os_version_info.dwBuildNumber >= 17623 ? "Windows Server 2019" : "Windows Server 2016"; if (os_version_info.dwBuildNumber >= 20201) {
// https://techcommunity.microsoft.com/t5/windows-server-insiders/announcing/m-p/1614436
return "Windows Server 2022";
}
if (os_version_info.dwBuildNumber >= 17623) {
// https://techcommunity.microsoft.com/t5/windows-server-insiders/announcing/m-p/173715
return "Windows Server 2019";
}
return "Windows Server 2016";
}
if (os_version_info.dwBuildNumber >= 21900) { // build numbers between 21391 and 21999 aren't used
return "Windows 11";
} }
return "Windows 10"; return "Windows 10";
} }