summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEran Mizrahi <erasmux@gmail.com>2018-01-06 03:51:34 +0200
committerEran Mizrahi <erasmux@gmail.com>2018-01-06 06:43:00 +0200
commit71995f03434be1a7f8b9877089af1bda24e8720b (patch)
tree726989f1fd414bfe4574ac9d0deb3e2785219a04 /src
parent5579db7f909b3d5c596456ea2cecb3f0d761a334 (diff)
preload openssl dlls (probably unnecessary but can help troubleshooting openssl issues)
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3e02a4a7..c64e2d8d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -419,6 +419,29 @@ void setupPath()
::SetEnvironmentVariableW(L"PATH", newPath.c_str());
}
+static void preloadSsl()
+{
+ QString appPath = QDir::toNativeSeparators(QCoreApplication::applicationDirPath());
+ if (GetModuleHandleA("libeay32.dll"))
+ qWarning("libeay32.dll already loaded?!");
+ else {
+ QString libeay32 = appPath + "\\libeay32.dll";
+ if (!QFile::exists(libeay32))
+ qWarning("libeay32.dll not found: %s", qPrintable(libeay32));
+ else if (!LoadLibraryW(libeay32.toStdWString().c_str()))
+ qWarning("failed to load: %s, %d", qPrintable(libeay32), GetLastError());
+ }
+ if (GetModuleHandleA("ssleay32.dll"))
+ qWarning("ssleay32.dll already loaded?!");
+ else {
+ QString ssleay32 = appPath + "\\ssleay32.dll";
+ if (!QFile::exists(ssleay32))
+ qWarning("ssleay32.dll not found: %s", qPrintable(ssleay32));
+ else if (!LoadLibraryW(ssleay32.toStdWString().c_str()))
+ qWarning("failed to load: %s, %d", qPrintable(ssleay32), GetLastError());
+ }
+}
+
static QString getVersionDisplayString()
{
VS_FIXEDFILEINFO version = GetFileVersion(ToWString(QApplication::applicationFilePath()));
@@ -442,6 +465,13 @@ int runApplication(MOApplication &application, SingleInstance &instance,
#endif
);
+#if !defined(QT_NO_SSL)
+ preloadSsl();
+ qDebug("ssl support: %d", QSslSocket::supportsSsl());
+#else
+ qDebug("non-ssl build");
+#endif
+
QString dataPath = application.property("dataPath").toString();
qDebug("data path: %s", qPrintable(dataPath));
@@ -618,12 +648,6 @@ int main(int argc, char *argv[])
setupPath();
- #if !defined(QT_NO_SSL)
- qDebug("ssl support: %d", QSslSocket::supportsSsl());
- #else
- qDebug("non-ssl build");
- #endif
-
bool forcePrimary = false;
if (arguments.contains("update")) {
arguments.removeAll("update");