From 2433ee06efdcd93b55d7005a96b7e5f6783cefe6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 12 Dec 2013 15:11:36 +0100 Subject: Windows/Windows CE: Do not dynamically load shell32/coredll. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those libraries are contained in QMAKE_LIBS_CORE and GetSpecialFolderPath() is present in all supported versions. Change-Id: Iae40714e0f234625b063aeb50e29fc79c4aaa6ea Reviewed-by: Björn Breitmeyer Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qsettings.cpp | 14 +++----------- src/corelib/io/qstandardpaths_win.cpp | 22 +--------------------- src/tools/bootstrap/bootstrap.pro | 2 +- 3 files changed, 5 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 8b67fc1962..db4612ae33 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -78,6 +78,7 @@ #ifdef Q_OS_WIN // for homedirpath reading from registry # include # include +# include #endif #ifdef Q_OS_WINRT @@ -1036,18 +1037,9 @@ static QString windowsConfigPath(int type) { QString result; -#ifndef Q_OS_WINCE - QSystemLibrary library(QLatin1String("shell32")); -#else - QSystemLibrary library(QLatin1String("coredll")); -#endif // Q_OS_WINCE - typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL); - GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW"); - if (SHGetSpecialFolderPath) { - wchar_t path[MAX_PATH]; - SHGetSpecialFolderPath(0, path, type, false); + wchar_t path[MAX_PATH]; + if (SHGetSpecialFolderPath(0, path, type, false)) result = QString::fromWCharArray(path); - } if (result.isEmpty()) { switch (type) { diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 200cf4c1b5..a0344a0206 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -68,21 +68,6 @@ QT_BEGIN_NAMESPACE -typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL); -static GetSpecialFolderPath resolveGetSpecialFolderPath() -{ - static GetSpecialFolderPath gsfp = 0; - if (!gsfp) { -#ifndef Q_OS_WINCE - QSystemLibrary library(QLatin1String("shell32")); -#else - QSystemLibrary library(QLatin1String("coredll")); -#endif // Q_OS_WINCE - gsfp = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW"); - } - return gsfp; -} - static QString convertCharArray(const wchar_t *path) { return QDir::fromNativeSeparators(QString::fromWCharArray(path)); @@ -92,10 +77,6 @@ QString QStandardPaths::writableLocation(StandardLocation type) { QString result; - static GetSpecialFolderPath SHGetSpecialFolderPath = resolveGetSpecialFolderPath(); - if (!SHGetSpecialFolderPath) - return QString(); - wchar_t path[MAX_PATH]; switch (type) { @@ -185,8 +166,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type) // type-specific handling goes here #ifndef Q_OS_WINCE - static GetSpecialFolderPath SHGetSpecialFolderPath = resolveGetSpecialFolderPath(); - if (SHGetSpecialFolderPath) { + { wchar_t path[MAX_PATH]; switch (type) { case ConfigLocation: // same as DataLocation, on Windows (oversight, but too late to fix it) diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 967f45d5df..8eb8401543 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -148,7 +148,7 @@ macx { if(contains(QT_CONFIG, zlib)|cross_compile):include(../../3rdparty/zlib.pri) else:include(../../3rdparty/zlib_dependency.pri) -win32:LIBS += -luser32 -lole32 -ladvapi32 +win32:LIBS += -luser32 -lole32 -ladvapi32 -lshell32 lib.CONFIG = dummy_install INSTALLS += lib -- cgit v1.2.3