|
| 1 | +diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp |
| 2 | +index a20a274870..30ef0625db 100644 |
| 3 | +--- a/src/corelib/io/qlockfile_win.cpp |
| 4 | ++++ b/src/corelib/io/qlockfile_win.cpp |
| 5 | +@@ -48,6 +48,8 @@ |
| 6 | + #include "QtCore/qdebug.h" |
| 7 | + #include "QtCore/qthread.h" |
| 8 | + |
| 9 | ++#include "private/qsystemlibrary_p.h" |
| 10 | ++ |
| 11 | + QT_BEGIN_NAMESPACE |
| 12 | + |
| 13 | + static inline bool fileExists(const wchar_t *fileName) |
| 14 | +@@ -150,7 +152,7 @@ QString QLockFilePrivate::processNameByPid(qint64 pid) |
| 15 | + #if !defined(Q_OS_WINRT) |
| 16 | + typedef DWORD (WINAPI *GetModuleFileNameExFunc)(HANDLE, HMODULE, LPTSTR, DWORD); |
| 17 | + |
| 18 | +- HMODULE hPsapi = LoadLibraryA("psapi"); |
| 19 | ++ HMODULE hPsapi = QSystemLibrary::load(L"psapi"); |
| 20 | + if (!hPsapi) |
| 21 | + return QString(); |
| 22 | + GetModuleFileNameExFunc qGetModuleFileNameEx = reinterpret_cast<GetModuleFileNameExFunc>( |
| 23 | +diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp |
| 24 | +index 4e84c0954b..a2f1133bc0 100644 |
| 25 | +--- a/src/network/kernel/qauthenticator.cpp |
| 26 | ++++ b/src/network/kernel/qauthenticator.cpp |
| 27 | +@@ -50,6 +50,7 @@ |
| 28 | + #include <qstring.h> |
| 29 | + #include <qdatetime.h> |
| 30 | + #include <qrandom.h> |
| 31 | ++#include "private/qsystemlibrary_p.h" |
| 32 | + |
| 33 | + #ifdef Q_OS_WIN |
| 34 | + #include <qmutex.h> |
| 35 | +diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp |
| 36 | +index 65b3e7f430..ff04fbbf98 100644 |
| 37 | +--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp |
| 38 | ++++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp |
| 39 | +@@ -48,6 +48,7 @@ |
| 40 | + #include <qpa/qplatformnativeinterface.h> |
| 41 | + #include <QtPlatformHeaders/qwglnativecontext.h> |
| 42 | + |
| 43 | ++#include <private/qsystemlibrary_p.h> |
| 44 | + #include <algorithm> |
| 45 | + |
| 46 | + #include <wingdi.h> |
| 47 | +@@ -162,19 +163,25 @@ QFunctionPointer QWindowsOpengl32DLL::resolve(const char *name) |
| 48 | + |
| 49 | + bool QWindowsOpengl32DLL::init(bool softwareRendering) |
| 50 | + { |
| 51 | +- const QByteArray opengl32 = QByteArrayLiteral("opengl32.dll"); |
| 52 | +- const QByteArray swopengl = QByteArrayLiteral("opengl32sw.dll"); |
| 53 | ++ const QByteArray opengl32 = QByteArrayLiteral("opengl32"); |
| 54 | ++ const QByteArray swopengl = QByteArrayLiteral("opengl32sw"); |
| 55 | ++ bool useSystemLib = false; |
| 56 | + |
| 57 | + QByteArray openglDll = qgetenv("QT_OPENGL_DLL"); |
| 58 | +- if (openglDll.isEmpty()) |
| 59 | ++ if (openglDll.isEmpty()) { |
| 60 | + openglDll = softwareRendering ? swopengl : opengl32; |
| 61 | ++ useSystemLib = !softwareRendering; |
| 62 | ++ } |
| 63 | + |
| 64 | + openglDll = openglDll.toLower(); |
| 65 | + m_nonOpengl32 = openglDll != opengl32; |
| 66 | + |
| 67 | + qCDebug(lcQpaGl) << "Qt: Using WGL and OpenGL from" << openglDll; |
| 68 | + |
| 69 | +- m_lib = ::LoadLibraryA(openglDll.constData()); |
| 70 | ++ if (useSystemLib) |
| 71 | ++ m_lib = QSystemLibrary::load((wchar_t*)(QString::fromLatin1(openglDll).utf16())); |
| 72 | ++ else |
| 73 | ++ m_lib = LoadLibraryA(openglDll.constData()); |
| 74 | + if (!m_lib) { |
| 75 | + qErrnoWarning(::GetLastError(), "Failed to load %s", openglDll.constData()); |
| 76 | + return false; |
| 77 | +@@ -184,7 +191,7 @@ bool QWindowsOpengl32DLL::init(bool softwareRendering) |
| 78 | + // Load opengl32.dll always. GDI functions like ChoosePixelFormat do |
| 79 | + // GetModuleHandle for opengl32.dll and behave differently (and call back into |
| 80 | + // opengl32) when the module is present. This is fine for dummy contexts and windows. |
| 81 | +- ::LoadLibraryA("opengl32.dll"); |
| 82 | ++ QSystemLibrary::load(L"opengl32"); |
| 83 | + } |
| 84 | + |
| 85 | + wglCreateContext = reinterpret_cast<HGLRC (WINAPI *)(HDC)>(resolve("wglCreateContext")); |
| 86 | +diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp |
| 87 | +index 49da6ee3e3..d78a18b35d 100644 |
| 88 | +--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp |
| 89 | ++++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp |
| 90 | +@@ -49,6 +49,7 @@ |
| 91 | + #include <QtCore/qstandardpaths.h> |
| 92 | + #include <QtCore/qlibraryinfo.h> |
| 93 | + #include <QtCore/qhash.h> |
| 94 | ++#include <private/qsystemlibrary_p.h> |
| 95 | + |
| 96 | + #ifndef QT_NO_OPENGL |
| 97 | + #include <private/qopengl_p.h> |
| 98 | +@@ -396,7 +397,7 @@ bool QWindowsOpenGLTester::testDesktopGL() |
| 99 | + |
| 100 | + // Test #1: Load opengl32.dll and try to resolve an OpenGL 2 function. |
| 101 | + // This will typically fail on systems that do not have a real OpenGL driver. |
| 102 | +- lib = LoadLibraryA("opengl32.dll"); |
| 103 | ++ lib = QSystemLibrary::load(L"opengl32"); |
| 104 | + if (lib) { |
| 105 | + CreateContext = reinterpret_cast<CreateContextType>( |
| 106 | + reinterpret_cast<QFunctionPointer>(::GetProcAddress(lib, "wglCreateContext"))); |
0 commit comments