diff options
author | Pali Rohár <pali@kernel.org> | 2024-02-24 16:09:35 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2024-02-24 20:47:05 +0100 |
commit | 26d05a62e4babea0fa364fd1690f8b9f5792bfc1 (patch) | |
tree | 054497c84d2765716c87795d6360c17839a96d45 | |
parent | 3138732eb50a586c994847c07f00be12264f1da0 (diff) | |
download | pciutils-26d05a62e4babea0fa364fd1690f8b9f5792bfc1.tar.gz |
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.
-rw-r--r-- | lib/win32-cfgmgr32.c | 9 |
1 files changed, 9 insertions, 0 deletions
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 |