From 8e6f2fcd2580894419c2807f8c1c5a8630a7d644 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Sat, 25 Dec 2021 13:45:17 +0100 Subject: [PATCH] libpci: i386-io-windows.h: Skip I/O setup on 16/32-bit non-NT systems 16/32-bit non-NT systems allow applications to access PCI I/O ports without any special setup. --- lib/i386-io-windows.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/i386-io-windows.h b/lib/i386-io-windows.h index d5823ee..e2492df 100644 --- a/lib/i386-io-windows.h +++ b/lib/i386-io-windows.h @@ -36,6 +36,17 @@ intel_setup_io(struct pci_access *a) MYPROC InitializeWinIo; HMODULE lib; +#ifndef _WIN64 + /* 16/32-bit non-NT systems allow applications to access PCI I/O ports without any special setup. */ + OSVERSIONINFOA version; + version.dwOSVersionInfoSize = sizeof(version); + if (GetVersionExA(&version) && version.dwPlatformId < VER_PLATFORM_WIN32_NT) + { + a->debug("Detected 16/32-bit non-NT system, skipping NT setup..."); + return 1; + } +#endif + lib = LoadLibrary("WinIo.dll"); if (!lib) { -- 2.39.2