diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2018-01-05 23:15:07 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-01-05 23:15:07 -0600 |
| commit | d2c5ed352dd1c0aac0478ca6d0e8cb121adc1b51 (patch) | |
| tree | 726989f1fd414bfe4574ac9d0deb3e2785219a04 /src/main.cpp | |
| parent | d2f90e6a761da3742789ce25779fe176e2a11aaf (diff) | |
| parent | 71995f03434be1a7f8b9877089af1bda24e8720b (diff) | |
Merge pull request #195 from erasmux/dev
Cleaner openssl deployment and add diagnostics for openssl loading
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 36 |
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");
|
