summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2016-08-15 11:16:58 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2016-08-16 07:39:24 +0000
commitf922dc165c61faeba39441595cb67dcf088ee8c8 (patch)
tree2d6c81175cb095d0a00263715ae8494d3589e0cf
parent7fe90b93e5f29dc2174e2050e31ee03e814be84c (diff)
idc: Search %PATH% when loading libraries
Call LoadLibraryEx() with flags=0 in addition to get the LoadLibrary() behavior (search %PATH%). Amends change 824df695ad99d6096c2744bd476f75822cee1323. Task-number: QTBUG-55283 Change-Id: Ib10eea9f71677c877f5316b45562ed48d1cc31cb Reviewed-by: Fredrik Orderud <forderud@gmail.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/tools/idc/main.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/tools/idc/main.cpp b/src/tools/idc/main.cpp
index 61e51e4..50610ac 100644
--- a/src/tools/idc/main.cpp
+++ b/src/tools/idc/main.cpp
@@ -181,12 +181,17 @@ static bool attachTypeLibrary(const QString &applicationName, int resource, cons
static HMODULE loadLibraryQt(const QString &input)
{
+ const wchar_t *inputC = reinterpret_cast<const wchar_t *>(input.utf16());
if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA)
- return LoadLibrary(reinterpret_cast<const wchar_t *>(input.utf16())); // fallback for Windows XP and older
+ return LoadLibrary(inputC); // fallback for Windows XP and older
// Load DLL with the folder containing the DLL temporarily added to the search path when loading dependencies
- return LoadLibraryEx(reinterpret_cast<const wchar_t *>(input.utf16()), NULL,
- LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
+ HMODULE result =
+ LoadLibraryEx(inputC, NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
+ // If that fails, call with flags=0 to get LoadLibrary() behavior (search %PATH%).
+ if (!result)
+ result = LoadLibraryEx(inputC, NULL, 0);
+ return result;
}
static bool registerServer(const QString &input)