summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-16 19:37:22 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-16 19:37:22 +0300
commit2b2fccea368d2cf6639c037c771f65e4b285afdd (patch)
tree37ae7f9e0f8895bceb2e0824d9941b85e4aabac2 /plugins
parent634a32a8d9114b1da1ffd0dc2b78dde3060a731f (diff)
fixes crash in mdbx under XP
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dbx_mdbx/src/init.cpp5
-rw-r--r--plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c41
2 files changed, 5 insertions, 41 deletions
diff --git a/plugins/Dbx_mdbx/src/init.cpp b/plugins/Dbx_mdbx/src/init.cpp
index 5ab23c14f8..bd73b6e1db 100644
--- a/plugins/Dbx_mdbx/src/init.cpp
+++ b/plugins/Dbx_mdbx/src/init.cpp
@@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
+EXTERN_C void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved);
+
int hLangpack;
static PLUGININFOEX pluginInfo =
@@ -126,8 +128,9 @@ extern "C" __declspec(dllexport) int Unload(void)
return 0;
}
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD, LPVOID)
+BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID reserved)
{
g_hInst = hInstDLL;
+ tls_callback(hInstDLL, reason, reserved);
return TRUE;
}
diff --git a/plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c b/plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c
index 0cd28d3bd4..0cf908aae0 100644
--- a/plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c
+++ b/plugins/Dbx_mdbx/src/libmdbx/src/lck-windows.c
@@ -29,7 +29,7 @@
static CRITICAL_SECTION rthc_critical_section;
-static void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved) {
+void NTAPI tls_callback(PVOID module, DWORD reason, PVOID reserved) {
(void)module;
(void)reserved;
switch (reason) {
@@ -52,45 +52,6 @@ void mdbx_rthc_lock(void) { EnterCriticalSection(&rthc_critical_section); }
void mdbx_rthc_unlock(void) { LeaveCriticalSection(&rthc_critical_section); }
-/* *INDENT-OFF* */
-/* clang-format off */
-#if defined(_MSC_VER)
-# pragma const_seg(push)
-# pragma data_seg(push)
-
-# ifdef _WIN64
- /* kick a linker to create the TLS directory if not already done */
-# pragma comment(linker, "/INCLUDE:_tls_used")
- /* Force some symbol references. */
-# pragma comment(linker, "/INCLUDE:mdbx_tls_callback")
- /* specific const-segment for WIN64 */
-# pragma const_seg(".CRT$XLB")
- const
-# else
- /* kick a linker to create the TLS directory if not already done */
-# pragma comment(linker, "/INCLUDE:__tls_used")
- /* Force some symbol references. */
-# pragma comment(linker, "/INCLUDE:_mdbx_tls_callback")
- /* specific data-segment for WIN32 */
-# pragma data_seg(".CRT$XLB")
-# endif
-
- PIMAGE_TLS_CALLBACK mdbx_tls_callback = tls_callback;
-# pragma data_seg(pop)
-# pragma const_seg(pop)
-
-#elif defined(__GNUC__)
-# ifdef _WIN64
- const
-# endif
- PIMAGE_TLS_CALLBACK mdbx_tls_callback __attribute__((section(".CRT$XLB"), used))
- = tls_callback;
-#else
-# error FIXME
-#endif
-/* *INDENT-ON* */
-/* clang-format on */
-
/*----------------------------------------------------------------------------*/
#define LCK_SHARED 0