diff options
Diffstat (limited to 'src')
28 files changed, 379 insertions, 109 deletions
diff --git a/src/activeqt/shared/qaxtypes.cpp b/src/activeqt/shared/qaxtypes.cpp index 0cfc7eb..957733e 100644 --- a/src/activeqt/shared/qaxtypes.cpp +++ b/src/activeqt/shared/qaxtypes.cpp @@ -52,7 +52,7 @@ #include <qobject.h> #ifdef QAX_SERVER # include <qaxfactory.h> -# include <qlibrary.h> +# include <private/qsystemlibrary_p.h> #else # include <quuid.h> # include <qaxobject.h> @@ -666,7 +666,7 @@ bool QVariantToVARIANT(const QVariant &var, VARIANT &arg, const QByteArray &type static bool resolved = false; if (!resolved) { resolved = true; - pGetRecordInfoFromTypeInfo = (PGetRecordInfoFromTypeInfo)QLibrary::resolve(QLatin1String("oleaut32"), + pGetRecordInfoFromTypeInfo = (PGetRecordInfoFromTypeInfo)QSystemLibrary::resolve(QLatin1String("oleaut32"), "GetRecordInfoFromTypeInfo"); } if (!pGetRecordInfoFromTypeInfo) diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 35fa04b..d5c53bb 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -43,6 +43,7 @@ #include "qplatformdefs.h" #include "qabstractfileengine.h" #include "private/qfsfileengine_p.h" +#include <private/qsystemlibrary_p.h> #include <qdebug.h> #include "qfile.h" @@ -177,7 +178,7 @@ void QFSFileEnginePrivate::resolveLibs() triedResolve = true; #if !defined(Q_OS_WINCE) - HINSTANCE advapiHnd = LoadLibrary(L"advapi32"); + HINSTANCE advapiHnd = QSystemLibrary::load(L"advapi32"); if (advapiHnd) { ptrGetNamedSecurityInfoW = (PtrGetNamedSecurityInfoW)GetProcAddress(advapiHnd, "GetNamedSecurityInfoW"); ptrLookupAccountSidW = (PtrLookupAccountSidW)GetProcAddress(advapiHnd, "LookupAccountSidW"); @@ -209,7 +210,7 @@ void QFSFileEnginePrivate::resolveLibs() ptrFreeSid(pWorld); } } - HINSTANCE userenvHnd = LoadLibrary(L"userenv"); + HINSTANCE userenvHnd = QSystemLibrary::load(L"userenv"); if (userenvHnd) ptrGetUserProfileDirectoryW = (PtrGetUserProfileDirectoryW)GetProcAddress(userenvHnd, "GetUserProfileDirectoryW"); #endif @@ -240,7 +241,7 @@ bool QFSFileEnginePrivate::resolveUNCLibs() #endif triedResolve = true; #if !defined(Q_OS_WINCE) - HINSTANCE hLib = LoadLibrary(L"netapi32"); + HINSTANCE hLib = QSystemLibrary::load(L"Netapi32"); if (hLib) { ptrNetShareEnum = (PtrNetShareEnum)GetProcAddress(hLib, "NetShareEnum"); if (ptrNetShareEnum) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index f802412..edd6d2b 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -69,7 +69,7 @@ #ifdef Q_OS_WIN // for homedirpath reading from registry #include "qt_windows.h" -#include "qlibrary.h" +#include <private/qsystemlibrary_p.h> #endif // Q_OS_WIN #endif // QT_NO_QOBJECT @@ -1046,9 +1046,9 @@ static QString windowsConfigPath(int type) // We can't use QLibrary if there is QT_NO_QOBJECT is defined // This only happens when bootstrapping qmake. #ifndef Q_OS_WINCE - QLibrary library(QLatin1String("shell32")); + QSystemLibrary library(QLatin1String("shell32")); #else - QLibrary library(QLatin1String("coredll")); + QSystemLibrary library(QLatin1String("coredll")); #endif // Q_OS_WINCE typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL); GetSpecialFolderPath SHGetSpecialFolderPath = (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW"); diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index e3f537f..153ccdf 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -43,7 +43,7 @@ #include "qcoreapplication.h" #include "qhash.h" -#include "qlibrary.h" +#include <private/qsystemlibrary_p.h> #include "qpair.h" #include "qset.h" #include "qsocketnotifier.h" @@ -65,7 +65,11 @@ extern uint qGlobalPostedEventsCount(); #endif #ifndef QS_RAWINPUT +# ifdef Q_OS_WINCE +# define QS_RAWINPUT 0x0000 +# else # define QS_RAWINPUT 0x0400 +# endif #endif #ifndef WM_TOUCH @@ -80,8 +84,7 @@ extern uint qGlobalPostedEventsCount(); enum { WM_QT_SOCKETNOTIFIER = WM_USER, - WM_QT_SENDPOSTEDEVENTS = WM_USER + 1, - SendPostedEventsTimerId = ~1u + WM_QT_SENDPOSTEDEVENTS = WM_USER + 1 }; #if defined(Q_OS_WINCE) @@ -323,11 +326,11 @@ static void resolveTimerAPI() #endif triedResolve = true; #if !defined(Q_OS_WINCE) - qtimeSetEvent = (ptimeSetEvent)QLibrary::resolve(QLatin1String("winmm"), "timeSetEvent"); - qtimeKillEvent = (ptimeKillEvent)QLibrary::resolve(QLatin1String("winmm"), "timeKillEvent"); + qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeSetEvent"); + qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeKillEvent"); #else - qtimeSetEvent = (ptimeSetEvent)QLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent"); - qtimeKillEvent = (ptimeKillEvent)QLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent"); + qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent"); + qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent"); #endif } } @@ -516,12 +519,10 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp) if (q) { QEventDispatcherWin32Private *d = q->d_func(); int localSerialNumber = d->serialNumber; -#ifdef Q_OS_WINCE - MSG dummyMsg; - if (HIWORD(GetQueueStatus(QS_INPUT)) == 0 - && PeekMessage(&dummyMsg, 0, WM_TIMER, WM_TIMER, PM_NOREMOVE) == 0 -#else - if (HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER)) == 0 + MSG unused; + if ((HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT)) == 0 + && PeekMessage(&unused, 0, WM_TIMER, WM_TIMER, PM_NOREMOVE) == 0) +#ifndef Q_OS_WINCE || GetMessageTime() - d->lastMessageTime >= 10 #endif ) { @@ -824,7 +825,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) pHandles[i] = d->winEventNotifierList.at(i)->handle(); emit aboutToBlock(); - waitRet = MsgWaitForMultipleObjectsEx(nCount, pHandles, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE); + waitRet = MsgWaitForMultipleObjectsEx(nCount, pHandles, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE | MWMO_INPUTAVAILABLE); emit awake(); if (waitRet >= WAIT_OBJECT_0 && waitRet < WAIT_OBJECT_0 + nCount) { d->activateEventNotifier(d->winEventNotifierList.at(waitRet - WAIT_OBJECT_0)); diff --git a/src/corelib/plugin/plugin.pri b/src/corelib/plugin/plugin.pri index c05ff48..ba86353 100644 --- a/src/corelib/plugin/plugin.pri +++ b/src/corelib/plugin/plugin.pri @@ -7,7 +7,8 @@ HEADERS += \ plugin/qlibrary_p.h \ plugin/qplugin.h \ plugin/quuid.h \ - plugin/qfactoryloader_p.h + plugin/qfactoryloader_p.h \ + plugin/qsystemlibrary_p.h SOURCES += \ plugin/qpluginloader.cpp \ @@ -16,7 +17,9 @@ SOURCES += \ plugin/qlibrary.cpp win32 { - SOURCES += plugin/qlibrary_win.cpp + SOURCES += \ + plugin/qlibrary_win.cpp \ + plugin/qsystemlibrary.cpp } unix { diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp new file mode 100644 index 0000000..a11ed50 --- /dev/null +++ b/src/corelib/plugin/qsystemlibrary.cpp @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qsystemlibrary_p.h" +#include <QtCore/qvarlengtharray.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qfileinfo.h> + +/*! + + \internal + \class QSystemLibrary + + The purpose of this class is to load only libraries that are located in + well-known and trusted locations on the filesystem. It does not suffer from + the security problem that QLibrary has, therefore it will never search in + the current directory. + + The search order is the same as the order in DLL Safe search mode Windows, + except that we don't search: + * The current directory + * The 16-bit system directory. (normally c:\windows\system) + * The Windows directory. (normally c:\windows) + + This means that the effective search order is: + 1. Application path. + 2. System libraries path. + 3. Trying all paths inside the PATH environment variable. + + Note, when onlySystemDirectory is true it will skip 1) and 3). + + DLL Safe search mode is documented in the "Dynamic-Link Library Search + Order" document on MSDN. + + Since library loading code is sometimes shared between Windows and WinCE, + this class can also be used on WinCE. However, its implementation just + calls the LoadLibrary() function. This is ok since it is documented as not + loading from the current directory on WinCE. This behaviour is documented + in the documentation for LoadLibrary for Windows CE at MSDN. + (http://msdn.microsoft.com/en-us/library/ms886736.aspx) +*/ +#if defined(Q_OS_WINCE) +HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory/*= true*/) +{ + return ::LoadLibrary(libraryName); +} +#else + +#if !defined(QT_BOOTSTRAPPED) +extern QString qAppFileName(); +#endif + +static QString qSystemDirectory() +{ + QVarLengthArray<wchar_t, MAX_PATH> fullPath; + + UINT retLen = ::GetSystemDirectory(fullPath.data(), MAX_PATH); + if (retLen > MAX_PATH) { + fullPath.resize(retLen); + retLen = ::GetSystemDirectory(fullPath.data(), retLen); + } + // in some rare cases retLen might be 0 + return QString::fromWCharArray(fullPath.constData(), int(retLen)); +} + +HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory/*= true*/) +{ + QStringList searchOrder; + +#if !defined(QT_BOOTSTRAPPED) + if (!onlySystemDirectory) + searchOrder << QFileInfo(qAppFileName()).path(); +#endif + searchOrder << qSystemDirectory(); + + if (!onlySystemDirectory) { + const QString PATH(QLatin1String(qgetenv("PATH").constData())); + searchOrder << PATH.split(QLatin1Char(';'), QString::SkipEmptyParts); + } + QString fileName = QString::fromWCharArray(libraryName); + fileName.append(QLatin1String(".dll")); + + // Start looking in the order specified + for (int i = 0; i < searchOrder.count(); ++i) { + QString fullPathAttempt = searchOrder.at(i); + if (!fullPathAttempt.endsWith(QLatin1Char('\\'))) { + fullPathAttempt.append(QLatin1Char('\\')); + } + fullPathAttempt.append(fileName); + HINSTANCE inst = ::LoadLibrary((const wchar_t *)fullPathAttempt.utf16()); + if (inst != 0) + return inst; + } + return 0; + +} + +#endif //Q_OS_WINCE diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h new file mode 100644 index 0000000..3251a3c --- /dev/null +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSYSTEMLIBRARY_P_H +#define QSYSTEMLIBRARY_P_H + +#include <QtCore/qglobal.h> +#ifdef Q_OS_WIN +#include <qt_windows.h> +#include <QtCore/qstring.h> + +class QSystemLibrary +{ +public: + explicit QSystemLibrary(const QString &libraryName) + { + m_libraryName = libraryName; + m_handle = 0; + m_didLoad = false; + } + + explicit QSystemLibrary(const wchar_t *libraryName) + { + m_libraryName = QString::fromWCharArray(libraryName); + m_handle = 0; + m_didLoad = false; + } + + bool load(bool onlySystemDirectory = true) + { + m_handle = load((const wchar_t *)m_libraryName.utf16(), onlySystemDirectory); + m_didLoad = true; + return (m_handle != 0); + } + + bool isLoaded() + { + return (m_handle != 0); + } + + void *resolve(const char *symbol) + { + if (!m_didLoad) + load(); + if (!m_handle) + return 0; +#ifdef Q_OS_WINCE + return (void*)GetProcAddress(m_handle, (const wchar_t*)QString::fromLatin1(symbol).utf16()); +#else + return (void*)GetProcAddress(m_handle, symbol); +#endif + } + + static void *resolve(const QString &libraryName, const char *symbol) + { + return QSystemLibrary(libraryName).resolve(symbol); + } + + static Q_CORE_EXPORT HINSTANCE load(const wchar_t *lpFileName, bool onlySystemDirectory = true); +private: + HINSTANCE m_handle; + QString m_libraryName; + bool m_didLoad; +}; + +#endif //Q_OS_WIN + +#endif //QSYSTEMLIBRARY_P_H diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp index fc8575f..132d01f 100644 --- a/src/gui/accessible/qaccessible_win.cpp +++ b/src/gui/accessible/qaccessible_win.cpp @@ -42,7 +42,7 @@ #ifndef QT_NO_ACCESSIBILITY #include "qapplication.h" -#include "qlibrary.h" +#include <private/qsystemlibrary_p.h> #include "qmessagebox.h" // ### dependency #include "qt_windows.h" #include "qwidget.h" @@ -243,7 +243,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason) static bool resolvedNWE = false; if (!resolvedNWE) { resolvedNWE = true; - ptrNotifyWinEvent = (PtrNotifyWinEvent)QLibrary::resolve(QLatin1String("user32"), "NotifyWinEvent"); + ptrNotifyWinEvent = (PtrNotifyWinEvent)QSystemLibrary::resolve(QLatin1String("user32"), "NotifyWinEvent"); } if (!ptrNotifyWinEvent) return; diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index 258707c..5b192b4 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -52,7 +52,7 @@ #include <qbuffer.h> #include <qdir.h> #include <qstringlist.h> -#include <qlibrary.h> +#include <private/qsystemlibrary_p.h> #include "qfiledialog_win_p.h" #ifndef QT_NO_THREAD @@ -100,10 +100,10 @@ static void qt_win_resolve_libs() triedResolve = true; #if !defined(Q_WS_WINCE) - QLibrary lib(QLatin1String("shell32")); - ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW"); - ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW"); - ptrSHGetMalloc = (PtrSHGetMalloc) lib.resolve("SHGetMalloc"); + QSystemLibrary lib(L"shell32"); + ptrSHBrowseForFolder = (PtrSHBrowseForFolder)lib.resolve("SHBrowseForFolderW"); + ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList)lib.resolve("SHGetPathFromIDListW"); + ptrSHGetMalloc = (PtrSHGetMalloc)lib.resolve("SHGetMalloc"); #else // CE stores them in a different lib and does not use unicode version HINSTANCE handle = LoadLibrary(L"Ceshell"); @@ -409,7 +409,7 @@ static bool qt_win_set_IFileDialogOptions(IFileDialog *pfd, { if (!pSHCreateItemFromParsingName) { // This function is available only in Vista & above. - QLibrary shellLib(QLatin1String("Shell32")); + QSystemLibrary shellLib(QLatin1String("Shell32")); pSHCreateItemFromParsingName = (PtrSHCreateItemFromParsingName) shellLib.resolve("SHCreateItemFromParsingName"); if (!pSHCreateItemFromParsingName) diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp index ad8801a..5fca8f2 100644 --- a/src/gui/dialogs/qwizard_win.cpp +++ b/src/gui/dialogs/qwizard_win.cpp @@ -43,7 +43,7 @@ #ifndef QT_NO_STYLE_WINDOWSVISTA #include "qwizard_win_p.h" -#include "qlibrary.h" +#include <private/qsystemlibrary_p.h> #include "qwizard.h" #include "qpaintengine.h" #include "qapplication.h" @@ -706,7 +706,7 @@ bool QVistaHelper::resolveSymbols() static bool tried = false; if (!tried) { tried = true; - QLibrary dwmLib(QString::fromAscii("dwmapi")); + QSystemLibrary dwmLib(L"dwmapi"); pDwmIsCompositionEnabled = (PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled"); if (pDwmIsCompositionEnabled) { @@ -714,7 +714,7 @@ bool QVistaHelper::resolveSymbols() pDwmExtendFrameIntoClientArea = (PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea"); } - QLibrary themeLib(QString::fromAscii("uxtheme")); + QSystemLibrary themeLib(L"uxtheme"); pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed"); if (pIsAppThemed) { pDrawThemeBackground = (PtrDrawThemeBackground)themeLib.resolve("DrawThemeBackground"); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 0c48bfd..78028eb 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -68,7 +68,6 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c #include "qdatetime.h" #include "qpointer.h" #include "qhash.h" -#include "qlibrary.h" #include "qmetaobject.h" #include "qmime.h" #include "qpainter.h" @@ -94,6 +93,7 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c #include "qdebug.h" #include <private/qkeymapper_p.h> #include <private/qlocale_p.h> +#include <private/qsystemlibrary_p.h> #include "qevent_p.h" //#define ALIEN_DEBUG @@ -206,7 +206,7 @@ static void resolveAygLibs() { if (!aygResolved) { aygResolved = true; - QLibrary ayglib(QLatin1String("aygshell")); + QSystemLibrary ayglib(QLatin1String("aygshell")); if (!ayglib.load()) return; ptrRecognizeGesture = (AygRecognizeGesture) ayglib.resolve("SHRecognizeGesture"); @@ -833,10 +833,10 @@ void qt_init(QApplicationPrivate *priv, int) #ifndef Q_OS_WINCE ptrUpdateLayeredWindowIndirect = - (PtrUpdateLayeredWindowIndirect) QLibrary::resolve(QLatin1String("user32"), + (PtrUpdateLayeredWindowIndirect) QSystemLibrary::resolve(QLatin1String("user32"), "UpdateLayeredWindowIndirect"); ptrUpdateLayeredWindow = - (PtrUpdateLayeredWindow) QLibrary::resolve(QLatin1String("user32"), + (PtrUpdateLayeredWindow) QSystemLibrary::resolve(QLatin1String("user32"), "UpdateLayeredWindow"); if (ptrUpdateLayeredWindow && !ptrUpdateLayeredWindowIndirect) @@ -844,7 +844,7 @@ void qt_init(QApplicationPrivate *priv, int) // Notify Vista and Windows 7 that we support highter DPI settings ptrSetProcessDPIAware = (PtrSetProcessDPIAware) - QLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware"); + QSystemLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware"); if (ptrSetProcessDPIAware) ptrSetProcessDPIAware(); #endif @@ -865,30 +865,28 @@ void qt_init(QApplicationPrivate *priv, int) #elif !defined(Q_WS_WINCE) #if !defined(QT_NO_NATIVE_GESTURES) priv->GetGestureInfo = - (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"), + (PtrGetGestureInfo)QSystemLibrary::resolve(QLatin1String("user32"), "GetGestureInfo"); priv->GetGestureExtraArgs = - (PtrGetGestureExtraArgs)QLibrary::resolve(QLatin1String("user32"), + (PtrGetGestureExtraArgs)QSystemLibrary::resolve(QLatin1String("user32"), "GetGestureExtraArgs"); priv->CloseGestureInfoHandle = - (PtrCloseGestureInfoHandle)QLibrary::resolve(QLatin1String("user32"), + (PtrCloseGestureInfoHandle)QSystemLibrary::resolve(QLatin1String("user32"), "CloseGestureInfoHandle"); priv->SetGestureConfig = - (PtrSetGestureConfig)QLibrary::resolve(QLatin1String("user32"), + (PtrSetGestureConfig)QSystemLibrary::resolve(QLatin1String("user32"), "SetGestureConfig"); priv->GetGestureConfig = - (PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"), + (PtrGetGestureConfig)QSystemLibrary::resolve(QLatin1String("user32"), "GetGestureConfig"); #endif // QT_NO_NATIVE_GESTURES + QSystemLibrary libTheme(QLatin1String("uxtheme")); priv->BeginPanningFeedback = - (PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), - "BeginPanningFeedback"); + (PtrBeginPanningFeedback)libTheme.resolve("BeginPanningFeedback"); priv->UpdatePanningFeedback = - (PtrUpdatePanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), - "UpdatePanningFeedback"); + (PtrUpdatePanningFeedback)libTheme.resolve("UpdatePanningFeedback"); priv->EndPanningFeedback = - (PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), - "EndPanningFeedback"); + (PtrEndPanningFeedback)libTheme.resolve("EndPanningFeedback"); #endif #endif // QT_NO_GESTURES } @@ -2338,7 +2336,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa if (!oleaccChecked) { oleaccChecked = true; #if !defined(Q_OS_WINCE) - ptrLresultFromObject = (PtrLresultFromObject)QLibrary::resolve(QLatin1String("oleacc.dll"), "LresultFromObject"); + ptrLresultFromObject = (PtrLresultFromObject)QSystemLibrary::resolve(QLatin1String("oleacc"), "LresultFromObject"); #endif } if (ptrLresultFromObject) { @@ -3142,7 +3140,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg) if (curWin != 0) { if (!trackMouseEventLookup) { trackMouseEventLookup = true; - ptrTrackMouseEvent = (PtrTrackMouseEvent)QLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent"); + ptrTrackMouseEvent = (PtrTrackMouseEvent)QSystemLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent"); } if (ptrTrackMouseEvent && !qApp->d_func()->inPopupMode()) { // We always have to set the tracking, since @@ -3677,7 +3675,7 @@ static void initWinTabFunctions() if (!qt_is_gui_used) return; - QLibrary library(QLatin1String("wintab32")); + QSystemLibrary library(QLatin1String("wintab32")); if (library.load()) { ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW"); ptrWTGet = (PtrWTGet)library.resolve("WTGetW"); @@ -4100,7 +4098,7 @@ void QApplicationPrivate::initializeMultitouch_sys() value & (QT_NID_INTEGRATED_TOUCH | QT_NID_EXTERNAL_TOUCH | QT_NID_MULTI_INPUT); } - QLibrary library(QLatin1String("user32")); + QSystemLibrary library(QLatin1String("user32")); // MinGW (g++ 3.4.5) accepts only C casts. RegisterTouchWindow = (PtrRegisterTouchWindow)(library.resolve("RegisterTouchWindow")); GetTouchInputInfo = (PtrGetTouchInputInfo)(library.resolve("GetTouchInputInfo")); diff --git a/src/gui/kernel/qdesktopwidget_win.cpp b/src/gui/kernel/qdesktopwidget_win.cpp index 07dbc24..1b2dfe7 100644 --- a/src/gui/kernel/qdesktopwidget_win.cpp +++ b/src/gui/kernel/qdesktopwidget_win.cpp @@ -42,7 +42,7 @@ #include "qdesktopwidget.h" #include "qt_windows.h" #include "qapplication_p.h" -#include "qlibrary.h" +#include <private/qsystemlibrary_p.h> #include <qvector.h> #include <limits.h> #ifdef Q_WS_WINCE @@ -155,7 +155,7 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that) screenCount = 0; #ifndef Q_OS_WINCE - QLibrary user32Lib(QLatin1String("user32")); + QSystemLibrary user32Lib(QLatin1String("user32")); if (user32Lib.load()) { enumDisplayMonitors = (EnumFunc)user32Lib.resolve("EnumDisplayMonitors"); getMonitorInfo = (InfoFunc)user32Lib.resolve("GetMonitorInfoW"); @@ -173,7 +173,7 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that) enumDisplayMonitors = 0; getMonitorInfo = 0; #else - QLibrary coreLib(QLatin1String("coredll")); + QSystemLibrary coreLib(QLatin1String("coredll")); if (coreLib.load()) { // CE >= 4.0 case enumDisplayMonitors = (EnumFunc)coreLib.resolve("EnumDisplayMonitors"); diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index 6325d95..fee1580 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -401,7 +401,7 @@ bool QSoftKeyManagerPrivateS60::handleCommand(int command) foreach(QAction *menuAction, action->menu()->actions()) { QMenu *menu = menuAction->menu(); if(menu) - menuBar->addMenu(action->menu()); + menuBar->addMenu(menu); else menuBar->addAction(menuAction); } diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 59035b1..3d206fd 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -47,7 +47,6 @@ #include "qevent.h" #include "qimage.h" #include "qlayout.h" -#include "qlibrary.h" #include "qpainter.h" #include "qstack.h" #include "qt_windows.h" @@ -65,6 +64,7 @@ #include <private/qapplication_p.h> #include <private/qwininputcontext_p.h> #include <private/qpaintengine_raster_p.h> +#include <private/qsystemlibrary_p.h> #if defined(Q_WS_WINCE) #include "qguifunctions_wince.h" @@ -148,7 +148,7 @@ static void init_wintab_functions() #else if (!qt_is_gui_used) return; - QLibrary library(QLatin1String("wintab32")); + QSystemLibrary library(QLatin1String("wintab32")); ptrWTOpen = (PtrWTOpen)library.resolve("WTOpenW"); ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW"); ptrWTClose = (PtrWTClose)library.resolve("WTClose"); @@ -1890,7 +1890,7 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level) static bool function_resolved = false; if (!function_resolved) { ptrSetLayeredWindowAttributes = - (PtrSetLayeredWindowAttributes) QLibrary::resolve(QLatin1String("user32"), + (PtrSetLayeredWindowAttributes) QSystemLibrary::resolve(QLatin1String("user32"), "SetLayeredWindowAttributes"); function_resolved = true; } diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 579dd0b..720dd6d 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -44,7 +44,7 @@ #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) -#include "qlibrary.h" +#include <private/qsystemlibrary_p.h> #include "qapplication.h" #include "qbitmap.h" #include "qdrawutil.h" // for now @@ -126,7 +126,7 @@ QWindowsStylePrivate::QWindowsStylePrivate() #if defined(Q_WS_WIN) && !defined(Q_OS_WINCE) if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) { - QLibrary shellLib(QLatin1String("shell32")); + QSystemLibrary shellLib(QLatin1String("shell32")); pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo"); } #endif @@ -921,9 +921,9 @@ static const char *const question_xpm[] = { static QPixmap loadIconFromShell32( int resourceId, int size ) { #ifdef Q_OS_WINCE - HMODULE hmod = LoadLibrary(L"ceshell.dll"); + HMODULE hmod = LoadLibrary(L"ceshell"); #else - HMODULE hmod = LoadLibrary(L"shell32.dll"); + HMODULE hmod = QSystemLibrary::load(L"shell32"); #endif if( hmod ) { HICON iconHandle = (HICON)LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, size, size, 0); diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 8511592..58542e5 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -42,6 +42,7 @@ #include "qwindowsvistastyle.h" #include "qwindowsvistastyle_p.h" #include <private/qstylehelper_p.h> +#include <private/qsystemlibrary_p.h> #if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN) @@ -2574,7 +2575,7 @@ bool QWindowsVistaStylePrivate::resolveSymbols() static bool tried = false; if (!tried) { tried = true; - QLibrary themeLib(QLatin1String("uxtheme")); + QSystemLibrary themeLib(QLatin1String("uxtheme")); pSetWindowTheme = (PtrSetWindowTheme )themeLib.resolve("SetWindowTheme"); pIsThemePartDefined = (PtrIsThemePartDefined )themeLib.resolve("IsThemePartDefined"); pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize"); diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 8743807..d36011c 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -48,7 +48,7 @@ #include <private/qapplication_p.h> #include <private/qstylehelper_p.h> #include <private/qwidget_p.h> -#include <qlibrary.h> +#include <private/qsystemlibrary_p.h> #include <qpainter.h> #include <qpaintengine.h> #include <qwidget.h> @@ -344,7 +344,7 @@ bool QWindowsXPStylePrivate::resolveSymbols() static bool tried = false; if (!tried) { tried = true; - QLibrary themeLib(QLatin1String("uxtheme")); + QSystemLibrary themeLib(QLatin1String("uxtheme")); pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed"); if (pIsAppThemed) { pIsThemeActive = (PtrIsThemeActive )themeLib.resolve("IsThemeActive"); diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp index c50d363..8a03c5d 100644 --- a/src/gui/text/qfontdatabase_win.cpp +++ b/src/gui/text/qfontdatabase_win.cpp @@ -45,7 +45,7 @@ #include "qfont_p.h" #include "qfontengine_p.h" #include "qpaintdevice.h" -#include "qlibrary.h" +#include <private/qsystemlibrary_p.h> #include "qabstractfileengine.h" #include "qendian.h" @@ -1049,7 +1049,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) { if(!fnt->data.isEmpty()) { #ifndef Q_OS_WINCE - PtrAddFontMemResourceEx ptrAddFontMemResourceEx = (PtrAddFontMemResourceEx)QLibrary::resolve(QLatin1String("gdi32"), + PtrAddFontMemResourceEx ptrAddFontMemResourceEx = (PtrAddFontMemResourceEx)QSystemLibrary::resolve(QLatin1String("gdi32"), "AddFontMemResourceEx"); if (!ptrAddFontMemResourceEx) return; @@ -1111,7 +1111,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt) if (AddFontResource((LPCWSTR)fnt->fileName.utf16()) == 0) return; #else - PtrAddFontResourceExW ptrAddFontResourceExW = (PtrAddFontResourceExW)QLibrary::resolve(QLatin1String("gdi32"), + PtrAddFontResourceExW ptrAddFontResourceExW = (PtrAddFontResourceExW)QSystemLibrary::resolve(QLatin1String("gdi32"), "AddFontResourceExW"); if (!ptrAddFontResourceExW || ptrAddFontResourceExW((wchar_t*)fnt->fileName.utf16(), FR_PRIVATE, 0) == 0) @@ -1140,7 +1140,7 @@ bool QFontDatabase::removeApplicationFont(int handle) if (!removeSucceeded) return false; #else - PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx = (PtrRemoveFontMemResourceEx)QLibrary::resolve(QLatin1String("gdi32"), + PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx = (PtrRemoveFontMemResourceEx)QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontMemResourceEx"); if (!ptrRemoveFontMemResourceEx || !ptrRemoveFontMemResourceEx(font.handle)) @@ -1151,7 +1151,7 @@ bool QFontDatabase::removeApplicationFont(int handle) if (!RemoveFontResource((LPCWSTR)font.fileName.utf16())) return false; #else - PtrRemoveFontResourceExW ptrRemoveFontResourceExW = (PtrRemoveFontResourceExW)QLibrary::resolve(QLatin1String("gdi32"), + PtrRemoveFontResourceExW ptrRemoveFontResourceExW = (PtrRemoveFontResourceExW)QSystemLibrary::resolve(QLatin1String("gdi32"), "RemoveFontResourceExW"); if (!ptrRemoveFontResourceExW || !ptrRemoveFontResourceExW((LPCWSTR)font.fileName.utf16(), FR_PRIVATE, 0)) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 4bed2b5..82de0d5 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -50,7 +50,7 @@ #include "qt_windows.h" #include <private/qapplication_p.h> -#include <qlibrary.h> +#include <private/qsystemlibrary_p.h> #include <qpaintdevice.h> #include <qpainter.h> #include <limits.h> @@ -140,7 +140,7 @@ static void resolveGetCharWidthI() if (resolvedGetCharWidthI) return; resolvedGetCharWidthI = true; - ptrGetCharWidthI = (PtrGetCharWidthI)QLibrary::resolve(QLatin1String("gdi32"), "GetCharWidthI"); + ptrGetCharWidthI = (PtrGetCharWidthI)QSystemLibrary::resolve(QLatin1String("gdi32"), "GetCharWidthI"); } #endif // !defined(Q_WS_WINCE) diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index aab7e16..735de04 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -41,7 +41,7 @@ #include <qsettings.h> #include <qdir.h> -#include <qlibrary.h> +#include <private/qsystemlibrary_p.h> #include <qurl.h> #include <qstringlist.h> #include <qprocess.h> @@ -177,9 +177,9 @@ QString QDesktopServices::storageLocation(StandardLocation type) QString result; #ifndef Q_OS_WINCE - QLibrary library(QLatin1String("shell32")); + QSystemLibrary library(QLatin1String("shell32")); #else - QLibrary library(QLatin1String("coredll")); + QSystemLibrary library(QLatin1String("coredll")); #endif // Q_OS_WINCE typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL); static GetSpecialFolderPath SHGetSpecialFolderPath = diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp index a9585b9..fc5de44 100644 --- a/src/gui/util/qsystemtrayicon_win.cpp +++ b/src/gui/util/qsystemtrayicon_win.cpp @@ -54,7 +54,7 @@ #include <windowsx.h> #include <commctrl.h> -#include <QLibrary> +#include <private/qsystemlibrary_p.h> #include <QApplication> #include <QSettings> @@ -155,14 +155,14 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object) // Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx = - (PtrChangeWindowMessageFilterEx)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx"); + (PtrChangeWindowMessageFilterEx)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx"); if (pChangeWindowMessageFilterEx) { // Call the safer ChangeWindowMessageFilterEx API if available pChangeWindowMessageFilterEx(winId(), MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0); } else { static PtrChangeWindowMessageFilter pChangeWindowMessageFilter = - (PtrChangeWindowMessageFilter)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter"); + (PtrChangeWindowMessageFilter)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter"); if (pChangeWindowMessageFilter) { // Call the deprecated ChangeWindowMessageFilter API otherwise @@ -350,7 +350,7 @@ void QSystemTrayIconPrivate::install_sys() QRect QSystemTrayIconSys::findIconGeometry(const int iconId) { static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect = - (PtrShell_NotifyIconGetRect)QLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect"); + (PtrShell_NotifyIconGetRect)QSystemLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect"); if (Shell_NotifyIconGetRect) { Q_NOTIFYICONIDENTIFIER nid; diff --git a/src/network/kernel/qhostinfo_win.cpp b/src/network/kernel/qhostinfo_win.cpp index b30204b..8241c84 100644 --- a/src/network/kernel/qhostinfo_win.cpp +++ b/src/network/kernel/qhostinfo_win.cpp @@ -49,7 +49,7 @@ #include "qhostinfo_p.h" #include "private/qnativesocketengine_p.h" #include <ws2tcpip.h> -#include <qlibrary.h> +#include <private/qsystemlibrary_p.h> #include <qmutex.h> #include <qurl.h> #include <private/qmutexpool_p.h> @@ -90,13 +90,13 @@ static void resolveLibrary() // Attempt to resolve getaddrinfo(); without it we'll have to fall // back to gethostbyname(), which has no IPv6 support. #if !defined(Q_OS_WINCE) - local_getaddrinfo = (getaddrinfoProto) QLibrary::resolve(QLatin1String("ws2_32.dll"), "getaddrinfo"); - local_freeaddrinfo = (freeaddrinfoProto) QLibrary::resolve(QLatin1String("ws2_32.dll"), "freeaddrinfo"); - local_getnameinfo = (getnameinfoProto) QLibrary::resolve(QLatin1String("ws2_32.dll"), "getnameinfo"); + local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getaddrinfo"); + local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "freeaddrinfo"); + local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2_32"), "getnameinfo"); #else - local_getaddrinfo = (getaddrinfoProto) QLibrary::resolve(QLatin1String("ws2.dll"), "getaddrinfo"); - local_freeaddrinfo = (freeaddrinfoProto) QLibrary::resolve(QLatin1String("ws2.dll"), "freeaddrinfo"); - local_getnameinfo = (getnameinfoProto) QLibrary::resolve(QLatin1String("ws2.dll"), "getnameinfo"); + local_getaddrinfo = (getaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getaddrinfo"); + local_freeaddrinfo = (freeaddrinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "freeaddrinfo"); + local_getnameinfo = (getnameinfoProto) QSystemLibrary::resolve(QLatin1String("ws2"), "getnameinfo"); #endif } diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp index 056650d..a1d1df6 100644 --- a/src/network/kernel/qnetworkinterface_win.cpp +++ b/src/network/kernel/qnetworkinterface_win.cpp @@ -48,6 +48,7 @@ #include <qhostinfo.h> #include <qhash.h> #include <qurl.h> +#include <private/qsystemlibrary_p.h> QT_BEGIN_NAMESPACE @@ -66,7 +67,7 @@ static void resolveLibs() if (!done) { done = true; - HINSTANCE iphlpapiHnd = LoadLibrary(L"iphlpapi"); + HINSTANCE iphlpapiHnd = QSystemLibrary::load(L"iphlpapi"); if (iphlpapiHnd == NULL) return; diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index 537107e..a72ef38 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -51,6 +51,7 @@ #include <string.h> #include <qt_windows.h> #include <wininet.h> +#include <private/qsystemlibrary_p.h> /* * Information on the WinHTTP DLL: @@ -277,15 +278,15 @@ void QWindowsSystemProxy::init() return; #else // load the winhttp.dll library - HINSTANCE winhttpHnd = LoadLibrary(L"winhttp"); - if (!winhttpHnd) + QSystemLibrary lib(L"winhttp"); + if (!lib.load()) return; // failed to load - ptrWinHttpOpen = (PtrWinHttpOpen)GetProcAddress(winhttpHnd, "WinHttpOpen"); - ptrWinHttpCloseHandle = (PtrWinHttpCloseHandle)GetProcAddress(winhttpHnd, "WinHttpCloseHandle"); - ptrWinHttpGetProxyForUrl = (PtrWinHttpGetProxyForUrl)GetProcAddress(winhttpHnd, "WinHttpGetProxyForUrl"); - ptrWinHttpGetDefaultProxyConfiguration = (PtrWinHttpGetDefaultProxyConfiguration)GetProcAddress(winhttpHnd, "WinHttpGetDefaultProxyConfiguration"); - ptrWinHttpGetIEProxyConfigForCurrentUser = (PtrWinHttpGetIEProxyConfigForCurrentUser)GetProcAddress(winhttpHnd, "WinHttpGetIEProxyConfigForCurrentUser"); + ptrWinHttpOpen = (PtrWinHttpOpen)lib.resolve("WinHttpOpen"); + ptrWinHttpCloseHandle = (PtrWinHttpCloseHandle)lib.resolve("WinHttpCloseHandle"); + ptrWinHttpGetProxyForUrl = (PtrWinHttpGetProxyForUrl)lib.resolve("WinHttpGetProxyForUrl"); + ptrWinHttpGetDefaultProxyConfiguration = (PtrWinHttpGetDefaultProxyConfiguration)lib.resolve("WinHttpGetDefaultProxyConfiguration"); + ptrWinHttpGetIEProxyConfigForCurrentUser = (PtrWinHttpGetIEProxyConfigForCurrentUser)lib.resolve("WinHttpGetIEProxyConfigForCurrentUser"); // Try to obtain the Internet Explorer configuration. WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ieProxyConfig; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index d1225c1..6affa36 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -42,7 +42,11 @@ #include "qsslsocket_openssl_symbols_p.h" -#include <QtCore/qlibrary.h> +#ifdef Q_OS_WIN +# include <private/qsystemlibrary_p.h> +#else +# include <QtCore/qlibrary.h> +#endif #include <QtCore/qmutex.h> #include <private/qmutexpool_p.h> #include <QtCore/qdatetime.h> @@ -345,22 +349,22 @@ static QStringList findAllLibSsl() } # endif -static QPair<QLibrary*, QLibrary*> loadOpenSsl() +#ifdef Q_OS_WIN +static QPair<QSystemLibrary*, QSystemLibrary*> loadOpenSslWin32() { - QPair<QLibrary*,QLibrary*> pair; + QPair<QSystemLibrary*,QSystemLibrary*> pair; pair.first = 0; pair.second = 0; -# ifdef Q_OS_WIN - QLibrary *ssleay32 = new QLibrary(QLatin1String("ssleay32")); - if (!ssleay32->load()) { + QSystemLibrary *ssleay32 = new QSystemLibrary(QLatin1String("ssleay32")); + if (!ssleay32->load(false)) { // Cannot find ssleay32.dll delete ssleay32; return pair; } - QLibrary *libeay32 = new QLibrary(QLatin1String("libeay32")); - if (!libeay32->load()) { + QSystemLibrary *libeay32 = new QSystemLibrary(QLatin1String("libeay32")); + if (!libeay32->load(false)) { delete ssleay32; delete libeay32; return pair; @@ -369,7 +373,16 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl() pair.first = ssleay32; pair.second = libeay32; return pair; -# elif defined(Q_OS_SYMBIAN) +} +#else + +static QPair<QLibrary*, QLibrary*> loadOpenSsl() +{ + QPair<QLibrary*,QLibrary*> pair; + pair.first = 0; + pair.second = 0; + +# if defined(Q_OS_SYMBIAN) QLibrary *libssl = new QLibrary(QLatin1String("libssl")); if (!libssl->load()) { // Cannot find ssleay32.dll @@ -469,6 +482,7 @@ static QPair<QLibrary*, QLibrary*> loadOpenSsl() return pair; # endif } +#endif bool q_resolveOpenSslSymbols() { @@ -483,7 +497,11 @@ bool q_resolveOpenSslSymbols() return false; triedToResolveSymbols = true; +#ifdef Q_OS_WIN + QPair<QSystemLibrary *, QSystemLibrary *> libs = loadOpenSslWin32(); +#else QPair<QLibrary *, QLibrary *> libs = loadOpenSsl(); +#endif if (!libs.first || !libs.second) // failed to load them return false; diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index c49dba4..15070d4 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -5259,6 +5259,8 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() glExtensions |= FragmentProgram; if (extensions.match("GL_ARB_fragment_shader")) glExtensions |= FragmentShader; + if (extensions.match("GL_ARB_shader_objects")) + glExtensions |= FragmentShader; if (extensions.match("GL_ARB_ES2_compatibility")) glExtensions |= ES2Compatibility; if (extensions.match("GL_ARB_texture_mirrored_repeat")) diff --git a/src/qt3support/network/q3dns.cpp b/src/qt3support/network/q3dns.cpp index ab042c4..e0e9909 100644 --- a/src/qt3support/network/q3dns.cpp +++ b/src/qt3support/network/q3dns.cpp @@ -41,6 +41,7 @@ #include "qplatformdefs.h" #include "qbytearray.h" +#include <private/qsystemlibrary_p.h> #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_CYGWIN) # include "qt_windows.h" #else @@ -2299,7 +2300,7 @@ void Q3Dns::doResInit() bool gotNetworkParams = false; // try the API call GetNetworkParams() first and use registry lookup only // as a fallback - HINSTANCE hinstLib = LoadLibrary( L"iphlpapi" ); + HINSTANCE hinstLib = QSystemLibrary::load( L"iphlpapi" ); if ( hinstLib != 0 ) { #ifdef Q_OS_WINCE GNP getNetworkParams = (GNP) GetProcAddress( hinstLib, L"GetNetworkParams" ); diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index a74c9c1..ba844ea 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -87,7 +87,8 @@ unix:SOURCES += ../../corelib/io/qfsfileengine_unix.cpp \ ../../corelib/io/qfsfileengine_iterator_unix.cpp win32:SOURCES += ../../corelib/io/qfsfileengine_win.cpp \ - ../../corelib/io/qfsfileengine_iterator_win.cpp + ../../corelib/io/qfsfileengine_iterator_win.cpp \ + ../../corelib/plugin/qsystemlibrary.cpp \ macx: { QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported) |