summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mir_core/src/Windows/miranda.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/mir_core/src/Windows/miranda.cpp b/src/mir_core/src/Windows/miranda.cpp
index 5649a69e4c..caae854b7a 100644
--- a/src/mir_core/src/Windows/miranda.cpp
+++ b/src/mir_core/src/Windows/miranda.cpp
@@ -390,17 +390,27 @@ MIR_CORE_DLL(void) LeaveMessageLoop()
/////////////////////////////////////////////////////////////////////////////////////////
// entry point
+HMODULE hMsfteditDll = nullptr;
+
BOOL WINAPI DllMain(HINSTANCE hinstDLL, uint32_t fdwReason, LPVOID)
{
- if (fdwReason == DLL_PROCESS_ATTACH) {
+ switch (fdwReason) {
+ case DLL_PROCESS_ATTACH:
g_hInst = hinstDLL;
+ hMsfteditDll = LoadLibrary(L"msftedit.dll");
mir_tls = TlsAlloc();
LoadCoreModule();
- }
- else if (fdwReason == DLL_THREAD_DETACH) {
+ break;
+
+ case DLL_PROCESS_DETACH:
+ FreeLibrary(hMsfteditDll);
+ break;
+
+ case DLL_THREAD_DETACH:
HANDLE hEvent = TlsGetValue(mir_tls);
if (hEvent)
CloseHandle(hEvent);
+ break;
}
return TRUE;
}