]> mj.ucw.cz Git - pciutils.git/commitdiff
libpci: i386-io-windows.h: Skip I/O setup on 16/32-bit non-NT systems
authorPali Rohár <pali@kernel.org>
Sat, 25 Dec 2021 12:45:17 +0000 (13:45 +0100)
committerMartin Mareš <mj@ucw.cz>
Sun, 26 Dec 2021 21:32:18 +0000 (22:32 +0100)
16/32-bit non-NT systems allow applications to access PCI I/O ports without
any special setup.

lib/i386-io-windows.h

index d5823eed19bb215c81caf2bbe1c5c96ab65ba2ba..e2492df71a73e6c4f1c1b53f3332065aca928ee9 100644 (file)
@@ -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)
     {