diff options
Diffstat (limited to 'src/tools/idc/main.cpp')
-rw-r--r-- | src/tools/idc/main.cpp | 11 |
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) |