From: Frank Date: Fri, 5 Jun 2026 09:18:53 +0000 (+0800) Subject: windows: Fix inverted version check in win32_is_vista_system() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d013205d39eaff1b98bd22956bd2405f52dc07dc;p=thirdparty%2Fpciutils.git windows: Fix inverted version check in win32_is_vista_system() 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 --- diff --git a/lib/win32-helpers.c b/lib/win32-helpers.c index 728eadf..498ef15 100644 --- a/lib/win32-helpers.c +++ b/lib/win32-helpers.c @@ -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;