diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-18 13:11:50 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-18 13:11:56 +0200 |
commit | 46454bd6e0892ab6a9ac971a454f24b1f2535f14 (patch) | |
tree | e625a7141929cc55e9b24bda5f3000c1abd71f54 /src | |
parent | 45cd9f66f42c595ff429475170b6e623669363a6 (diff) | |
parent | 4329879b4d73936fe757591f19cb2a86cae1d6b7 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
Change-Id: Iac8c9e49fd96c80fff85277e02b7deb6a8a1b28e
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/idc/main.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tools/idc/main.cpp b/src/tools/idc/main.cpp index 60ec1e4..7d0c888 100644 --- a/src/tools/idc/main.cpp +++ b/src/tools/idc/main.cpp @@ -176,12 +176,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) @@ -233,7 +238,9 @@ static HRESULT dumpIdl(const QString &input, const QString &idlfile, const QStri HRESULT res = E_FAIL; if (hasExeExtension(input)) { - if (runWithQtInEnvironment(quotePath(input) + QLatin1String(" -dumpidl ") + idlfile + QLatin1String(" -version ") + version)) + const QString command = quotePath(input) + QLatin1String(" -dumpidl ") + + quotePath(idlfile) + QLatin1String(" -version ") + version; + if (runWithQtInEnvironment(command)) res = S_OK; } else { HMODULE hdll = loadLibraryQt(input); @@ -376,7 +383,7 @@ int runIdc(int argc, char **argv) fprintf(stderr, "%s\n", qPrintable(error)); return ok ? 0 : 4; } else if (!idlfile.isEmpty()) { - idlfile = quotePath(QDir::toNativeSeparators(idlfile)); + idlfile = QDir::toNativeSeparators(idlfile); fprintf(stderr, "\n\n%s\n\n", qPrintable(idlfile)); const HRESULT res = dumpIdl(input, idlfile, version); |