]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
windows: Fix inverted version check in win32_is_vista_system()
authorFrank <santos_1015@yahoo.com.tw>
Fri, 5 Jun 2026 09:18:53 +0000 (17:18 +0800)
committerMartin Mareš <mj@ucw.cz>
Mon, 8 Jun 2026 11:58:06 +0000 (13:58 +0200)
The non-x86 (#else) branch of win32_is_vista_system() returned FALSE
when dwMajorVersion >= 6, which is backwards: Windows Vista is NT 6.0,
so the function must return TRUE for major version >= 6. The x86 branch
was already correct ((raw_version & 0xff) >= 6 -> TRUE).

On x64 Windows this reported every Vista-or-later system as pre-Vista.
For win32-kldbg this is fatal: win32_kldbg_setup() bails out with
"requires Windows Vista or higher version", so the Kernel Local Debugging
Driver access method is never used and PCIe extended config space (and
thus Lane Margining) is unreachable on 64-bit Windows.

Fix by testing dwMajorVersion < 6. GetVersionEx() may report 6.2 without
a compatibility manifest, but < 6 is correct regardless of that cap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lib/win32-helpers.c

index 728eadfee27273adf588d214b51a35d4eb6ba0fd..498ef1569d769dab1e627917fe2174cf01c07375 100644 (file)
@@ -251,7 +251,7 @@ win32_is_vista_system(void)
   version.dwOSVersionInfoSize = sizeof(version);
   if (!GetVersionEx(&version) ||
       version.dwPlatformId != VER_PLATFORM_WIN32_NT ||
-      version.dwMajorVersion >= 6)
+      version.dwMajorVersion < 6)
     return FALSE;
   else
     return TRUE;