]> mj.ucw.cz Git - pciutils.git/commitdiff
libpci: win32-cfgmgr32: Do not include resolver for cfgmgr32 function for MinGW-w64
authorPali Rohár <pali@kernel.org>
Sat, 24 Feb 2024 15:09:35 +0000 (16:09 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 24 Feb 2024 19:47:05 +0000 (20:47 +0100)
MinGW-w64 toolchain (as opposite to MinGW32) provides all needed cfgmgr32
functions in import library. Use import library and do not resolve
functions at runtime.

lib/win32-cfgmgr32.c

index 37cf2f741369b75bb14284ebe07922629b6aeb4f..dbddc5468216bcc2736ccf353afbfb2d10070650 100644 (file)
 /*
  * Unfortunately MinGW32 toolchain does not provide import library for these
  * cfgmgr32.dll functions. So resolve pointers to these functions at runtime.
+ * MinGW-w64 toolchain provides them also in 32-bit mode.
  */
 
+#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
+
 #ifdef CM_Get_DevNode_Registry_PropertyA
 #undef CM_Get_DevNode_Registry_PropertyA
 #endif
@@ -129,6 +132,8 @@ resolve_cfgmgr32_functions(void)
   return TRUE;
 }
 
+#endif
+
 /*
  * cfgmgr32.dll uses custom non-Win32 error numbers which are unsupported by
  * Win32 APIs like GetLastError() and FormatMessage() functions.
@@ -1535,11 +1540,13 @@ win32_cfgmgr32_scan(struct pci_access *a)
   struct pci_dev *d;
   CONFIGRET cr;
 
+#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
   if (!resolve_cfgmgr32_functions())
     {
       a->warning("Required cfgmgr32.dll functions are unavailable.");
       return;
     }
+#endif
 
   /*
    * Explicitly initialize size to zero as wine cfgmgr32 implementation does not
@@ -1609,11 +1616,13 @@ win32_cfgmgr32_detect(struct pci_access *a)
   ULONG devinst_id_list_size;
   CONFIGRET cr;
 
+#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
   if (!resolve_cfgmgr32_functions())
     {
       a->debug("Required cfgmgr32.dll functions are unavailable.");
       return 0;
     }
+#endif
 
   /*
    * Explicitly initialize size to zero as wine cfgmgr32 implementation does not