From 26d05a62e4babea0fa364fd1690f8b9f5792bfc1 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Sat, 24 Feb 2024 16:09:35 +0100 Subject: libpci: win32-cfgmgr32: Do not include resolver for cfgmgr32 function for MinGW-w64 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/win32-cfgmgr32.c b/lib/win32-cfgmgr32.c index 37cf2f7..dbddc54 100644 --- a/lib/win32-cfgmgr32.c +++ b/lib/win32-cfgmgr32.c @@ -88,8 +88,11 @@ /* * 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 -- cgit 1.2.3-korg