From f9a5cf5b68f62f4bb6b2984d84b503ee9f85e425 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Thu, 3 Feb 2022 23:57:48 +0100 Subject: windows: Add "or later" to debug print of Windows version 8 Windows 10 and 11 is detected as Windows 8 unless there is an application manifest. We simply cannot tell by appropriate means. Note that we currently only use the detected version to check for the minimal version (Vista), so it doesn't matter much. Closes #1021 Signed-off-by: Tormod Volden --- libusb/os/windows_common.c | 7 +++++++ libusb/version_nano.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libusb/os/windows_common.c b/libusb/os/windows_common.c index d956bd9..24ac095 100644 --- a/libusb/os/windows_common.c +++ b/libusb/os/windows_common.c @@ -346,6 +346,8 @@ static enum windows_version get_windows_version(void) if ((vi.dwMajorVersion > 6) || ((vi.dwMajorVersion == 6) && (vi.dwMinorVersion >= 2))) { // Starting with Windows 8.1 Preview, GetVersionEx() does no longer report the actual OS version // See: http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074.aspx + // And starting with Windows 10 Preview 2, Windows enforces the use of the application/supportedOS + // manifest in order for VerSetConditionMask() to report the ACTUAL OS major and minor... major_equal = VerSetConditionMask(0, VER_MAJORVERSION, VER_EQUAL); for (major = vi.dwMajorVersion; major <= 9; major++) { @@ -381,6 +383,7 @@ static enum windows_version get_windows_version(void) ws = (vi.wProductType <= VER_NT_WORKSTATION); version = vi.dwMajorVersion << 4 | vi.dwMinorVersion; + switch (version) { case 0x50: winver = WINDOWS_2000; w = "2000"; break; case 0x51: winver = WINDOWS_XP; w = "XP"; break; @@ -402,6 +405,10 @@ static enum windows_version get_windows_version(void) w = "12 or later"; } + // We cannot tell if we are on 8, 10, or 11 without "app manifest" + if (version == 0x62 && vi.dwBuildNumber == 9200) + w = "8 (or later)"; + arch = is_x64() ? "64-bit" : "32-bit"; if (vi.wServicePackMinor) diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 710fa8e..d1f25b5 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11705 +#define LIBUSB_NANO 11706 -- cgit v1.2.1