From d00148de0809da08a0f2cae48fc36a54f3af2d0b Mon Sep 17 00:00:00 2001 From: PB Date: Sun, 9 Jun 2024 11:56:42 +0200 Subject: [PATCH] Recognize Windows Server 2019 in wxGetOsDescription() For some reason, testing for Windows Server 2019 was missing there. See #24598. (cherry picked from commit c7c6485c599008d760f88191320bbf02787147d4) --- docs/changes.txt | 4 ++++ src/msw/utils.cpp | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index e0a072510d..901dbcd4a9 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -262,6 +262,10 @@ wxGTK: - Fix wxListBox minimum size regression in 3.2.5 (#24551). - Allow positioning wxDialog at specified position, at least under X11 (#24552). +wxMSW: + +- Recognize Windows Server 2019 in wxGetOsDescription() (PB, #24598). + wxOSX: - Improve wxSlider ticks appearance (Hartwig Wiesmann, #24532). diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 7e6f164201..629ca5db5f 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -1097,6 +1097,8 @@ int wxIsWindowsServer() return -1; } +static const int WINDOWS_SERVER2019_BUILD = 17763; + // Windows 11 uses the same version as Windows 10 but its build numbers start // from 22000, which provides a way to test for it. static const int FIRST_WINDOWS11_BUILD = 22000; @@ -1165,13 +1167,20 @@ wxString wxGetOsDescription() case 10: if (info.dwBuildNumber >= FIRST_WINDOWS11_BUILD) + { str = wxIsWindowsServer() == 1 ? "Windows Server 2022" : "Windows 11"; + + } + else if ( wxIsWindowsServer() == 1 ) + { + str = info.dwBuildNumber >= WINDOWS_SERVER2019_BUILD + ? "Windows Server 2019" + : "Windows Server 2016"; + } else - str = wxIsWindowsServer() == 1 - ? "Windows Server 2016" - : "Windows 10"; + str = "Windows 10"; break; }