summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-02-16 22:59:10 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-02-16 22:59:10 +0300
commit89979c595a7711925499db9045cdc25e330b9f36 (patch)
tree6d8328802e5217d48e65473d57dd9a8f3f5b8419
parent4269a726e3ca96a1676d35600f32c29ae5e120a6 (diff)
OpenSSL: dynamic dll loading removed
-rw-r--r--plugins/OpenSSL/src/main.cpp20
-rw-r--r--plugins/OpenSSL/src/ssl_openssl.cpp30
-rw-r--r--plugins/OpenSSL/src/stdafx.h96
-rw-r--r--plugins/OpenSSL/src/version.h2
4 files changed, 54 insertions, 94 deletions
diff --git a/plugins/OpenSSL/src/main.cpp b/plugins/OpenSSL/src/main.cpp
index 7f03981446..e523acc96d 100644
--- a/plugins/OpenSSL/src/main.cpp
+++ b/plugins/OpenSSL/src/main.cpp
@@ -23,26 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
int LoadSslModule(void);
void UnloadSslModule(void);
-HMODULE g_hOpenSSL;
-HMODULE g_hOpenSSLCrypto;
-HMODULE g_hWinCrypt;
-
-FARPROC WINAPI delayHook(unsigned dliNotify, PDelayLoadInfo dli)
-{
- switch (dliNotify) {
- case dliNotePreLoadLibrary:
- if (!strcmpi(dli->szDll, "libeay32.dll"))
- return (FARPROC)g_hOpenSSLCrypto;
- else if (!strcmpi(dli->szDll, "ssleay32.dll"))
- return (FARPROC)g_hOpenSSL;
- else if (!strcmpi(dli->szDll, "crypt32.dll"))
- return (FARPROC)g_hWinCrypt;
- }
- return NULL;
-}
-
-extern "C" PfnDliHook __pfnDliNotifyHook2 = delayHook;
-
HINSTANCE hInst;
int hLangpack;
diff --git a/plugins/OpenSSL/src/ssl_openssl.cpp b/plugins/OpenSSL/src/ssl_openssl.cpp
index 6f0791475b..6340fcf09d 100644
--- a/plugins/OpenSSL/src/ssl_openssl.cpp
+++ b/plugins/OpenSSL/src/ssl_openssl.cpp
@@ -59,16 +59,7 @@ static void SSL_library_unload(void)
WaitForSingleObject(g_hSslMutex, INFINITE);
- FreeLibrary(g_hOpenSSL);
- g_hOpenSSL = NULL;
-
- FreeLibrary(g_hOpenSSLCrypto);
- g_hOpenSSLCrypto = NULL;
- FreeLibrary(g_hWinCrypt);
- g_hWinCrypt = NULL;
-
bSslInitDone = false;
-
ReleaseMutex(g_hSslMutex);
}
@@ -80,20 +71,13 @@ static bool SSL_library_load(void)
WaitForSingleObject(g_hSslMutex, INFINITE);
- if (!bSslInitDone) {
- g_hOpenSSLCrypto = LoadLibraryA("libeay32.dll");
- g_hOpenSSL = LoadLibraryA("ssleay32.dll");
- g_hWinCrypt = LoadLibraryA("crypt32.dll");
- if (g_hOpenSSL && g_hOpenSSLCrypto && g_hWinCrypt) {
- // init OpenSSL
- SSL_library_init();
- SSL_load_error_strings();
- CRYPTO_set_mem_functions(mir_calloc, mir_realloc, mir_free);
- // FIXME check errors
-
- bSslInitDone = true;
- }
- else SSL_library_unload();
+ if (!bSslInitDone) { // init OpenSSL
+ SSL_library_init();
+ SSL_load_error_strings();
+ CRYPTO_set_mem_functions(mir_calloc, mir_realloc, mir_free);
+ // FIXME check errors
+
+ bSslInitDone = true;
}
return bSslInitDone;
diff --git a/plugins/OpenSSL/src/stdafx.h b/plugins/OpenSSL/src/stdafx.h
index a6a030d8c6..4a218daaa4 100644
--- a/plugins/OpenSSL/src/stdafx.h
+++ b/plugins/OpenSSL/src/stdafx.h
@@ -1,51 +1,47 @@
-/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (c) 2012-17 Miranda NG project (http://miranda-ng.org),
-Copyright (c) 2000-12 Miranda IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#define SECURITY_WIN32
-#define HSSL_DEFINED
-
-typedef struct SslHandle *HSSL;
-
-#include <shlobj.h>
-#include <security.h>
-
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (c) 2012-17 Miranda NG project (http://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#define SECURITY_WIN32
+#define HSSL_DEFINED
+
+typedef struct SslHandle *HSSL;
+
+#include <shlobj.h>
+#include <security.h>
+
#define DELAYIMP_INSECURE_WRITABLE_HOOKS
-#include <delayimp.h>
-
-#include <newpluginapi.h>
-#include <m_netlib.h>
-#include <m_langpack.h>
-#include <m_string.h>
-#include <m_ssl.h>
-
-#include <openssl/ssl.h>
-#include <openssl/rand.h>
-
-#include "version.h"
-
-extern HMODULE g_hOpenSSL;
-extern HMODULE g_hOpenSSLCrypto;
-extern HMODULE g_hWinCrypt;
-
-extern HINSTANCE hInst;
+#include <delayimp.h>
+
+#include <newpluginapi.h>
+#include <m_netlib.h>
+#include <m_langpack.h>
+#include <m_string.h>
+#include <m_ssl.h>
+
+#include <openssl/ssl.h>
+#include <openssl/rand.h>
+
+#include "version.h"
+
+extern HINSTANCE hInst;
diff --git a/plugins/OpenSSL/src/version.h b/plugins/OpenSSL/src/version.h
index 12fd564a50..58237f9912 100644
--- a/plugins/OpenSSL/src/version.h
+++ b/plugins/OpenSSL/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>