From 98176fd7acd973e5c6397b5d89fa7d4aa0422009 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 31 Oct 2015 18:05:43 +0100 Subject: [PATCH] Really fix OS version detection for Windows 8.1 and later Fix several problems in d61b52a60e6c94c39f5e12b2e8d8e62511287f08. See #15321. Closes https://github.com/wxWidgets/wxWidgets/pull/114 --- docs/changes.txt | 2 +- src/msw/utils.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 6f3aa89244..afabf1e762 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -181,7 +181,7 @@ wxMSW: - Correct wxGetOsDescription() for Windows 10 (Tobias Taschner). - Make wxListCtrl &c appearance more native on modern systems (Tobias Taschner). - Don't send wxActivateEvent for minimized windows (bzcdr). -- Return correct OS version under Windows 8 and later. +- Return correct OS version under Windows 8.1 and later. wxOSX/Cocoa: diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 4e17bbe659..a86dec2974 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -1009,13 +1009,16 @@ OSVERSIONINFOEXW wxGetWindowsVersionInfo() // RtlGetVersion() directly, if it is available. #if wxUSE_DYNLIB_CLASS wxDynamicLibrary dllNtDll; - if ( dllNtDll.RawLoad(wxS("ntdll.dll")) ) + if ( dllNtDll.Load(wxS("ntdll.dll"), wxDL_VERBATIM | wxDL_QUIET) ) { typedef LONG /* NTSTATUS */ (WINAPI *RtlGetVersion_t)(OSVERSIONINFOEXW*); RtlGetVersion_t wxDL_INIT_FUNC(pfn, RtlGetVersion, dllNtDll); - if ( pfnRtlGetVersion && pfnRtlGetVersion(&info) ) + if ( pfnRtlGetVersion && + (pfnRtlGetVersion(&info) == 0 /* STATUS_SUCCESS */) ) + { return info; + } } #endif // wxUSE_DYNLIB_CLASS