From d6330a19b29ebff359a6746250c78437dbcaf77d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 19 Dec 2016 10:34:32 +0100 Subject: Use QT_CONFIG(library) instead of QT_NO_LIBRARY For the windows file system engine, we add an extra macro to use library loading if configured to do so, but avoid it on WinRT, as none of the symbols would be found. We also QT_REQUIRE_CONFIG(library) in the library headers and exclude the sources from the build if library loading is disabled. This, in turn, makes it necessary to clean up some header inclusions. Change-Id: I2b152cb5b47a2658996b6f4702b038536a5704ec Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qfilesystemengine_win.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/corelib/io/qfilesystemengine_win.cpp') diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index cdb64d08e1..0d4ef94622 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -158,14 +158,15 @@ Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0; #if defined(Q_OS_WINRT) static QString qfsPrivateCurrentDir = QLatin1String(""); -// As none of the functions we try to resolve do exist on WinRT -// we use QT_NO_LIBRARY to shorten everything up a little bit. -# ifndef QT_NO_LIBRARY -# define QT_NO_LIBRARY 1 -# endif +// As none of the functions we try to resolve do exist on WinRT we +// avoid library loading on WinRT in general to shorten everything +// up a little bit. +# define QT_FEATURE_fslibs -1 +#else +# define QT_FEATURE_fslibs QT_FEATURE_library #endif // Q_OS_WINRT -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) QT_BEGIN_INCLUDE_NAMESPACE typedef DWORD (WINAPI *PtrGetNamedSecurityInfoW)(LPWSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*); static PtrGetNamedSecurityInfoW ptrGetNamedSecurityInfoW = 0; @@ -273,7 +274,7 @@ static void resolveLibs() ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW"); } } -#endif // QT_NO_LIBRARY +#endif // QT_CONFIG(fslibs) typedef DWORD (WINAPI *PtrNetShareEnum)(LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD); static PtrNetShareEnum ptrNetShareEnum = 0; @@ -343,7 +344,7 @@ static QString readSymLink(const QFileSystemEntry &link) free(rdb); CloseHandle(handle); -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) resolveLibs(); QRegExp matchVolName(QLatin1String("^Volume\\{([a-z]|[0-9]|-)+\\}\\\\"), Qt::CaseInsensitive); if (matchVolName.indexIn(result) == 0) { @@ -353,7 +354,7 @@ static QString readSymLink(const QFileSystemEntry &link) if (GetVolumePathNamesForVolumeName(reinterpret_cast(volumeName.utf16()), buffer, MAX_PATH, &len) != 0) result.replace(0,matchVolName.matchedLength(), QString::fromWCharArray(buffer)); } -#endif // !Q_OS_WINRT +#endif // QT_CONFIG(fslibs) } #else Q_UNUSED(link); @@ -363,7 +364,7 @@ static QString readSymLink(const QFileSystemEntry &link) static QString readLink(const QFileSystemEntry &link) { -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) QString ret; bool neededCoInit = false; @@ -402,7 +403,7 @@ static QString readLink(const QFileSystemEntry &link) #else Q_UNUSED(link); return QString(); -#endif // QT_NO_LIBRARY +#endif // QT_CONFIG(fslibs) } static bool uncShareExists(const QString &server) @@ -648,7 +649,7 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) QString QFileSystemEngine::owner(const QFileSystemEntry &entry, QAbstractFileEngine::FileOwner own) { QString name; -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) extern int qt_ntfs_permission_lookup; if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) { resolveLibs(); @@ -698,7 +699,7 @@ QString QFileSystemEngine::owner(const QFileSystemEntry &entry, QAbstractFileEng bool QFileSystemEngine::fillPermissions(const QFileSystemEntry &entry, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what) { -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) if((qt_ntfs_permission_lookup > 0) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)) { resolveLibs(); if(ptrGetNamedSecurityInfoW && ptrBuildTrusteeWithSidW && ptrGetEffectiveRightsFromAclW) { @@ -1162,7 +1163,7 @@ QString QFileSystemEngine::rootPath() QString QFileSystemEngine::homePath() { QString ret; -#if !defined(QT_NO_LIBRARY) +#if QT_CONFIG(fslibs) resolveLibs(); if (ptrGetUserProfileDirectoryW) { HANDLE hnd = ::GetCurrentProcess(); -- cgit v1.2.3