summaryrefslogtreecommitdiff
path: root/plugins/CryptoPP
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CryptoPP')
-rw-r--r--plugins/CryptoPP/src/main.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp
index af7aa6306f..7869c8d416 100644
--- a/plugins/CryptoPP/src/main.cpp
+++ b/plugins/CryptoPP/src/main.cpp
@@ -31,14 +31,21 @@ PLUGININFOEX pluginInfoEx = {
BOOL WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID)
{
- g_hInst = hInst;
- InitializeCriticalSection(&localQueueMutex);
- InitializeCriticalSection(&localContextMutex);
-#ifdef _DEBUG
- isVista = 1;
-#else
- isVista = ( (DWORD)(LOBYTE(LOWORD(GetVersion()))) == 6 );
-#endif
+ if (dwReason == DLL_PROCESS_ATTACH) {
+ g_hInst = hInst;
+ #ifdef _DEBUG
+ isVista = 1;
+ #else
+ isVista = ( (DWORD)(LOBYTE(LOWORD(GetVersion()))) == 6 );
+ #endif
+ InitializeCriticalSection(&localQueueMutex);
+ InitializeCriticalSection(&localContextMutex);
+ }
+ else if (dwReason == DLL_PROCESS_DETACH) {
+ DeleteCriticalSection(&localQueueMutex);
+ DeleteCriticalSection(&localContextMutex);
+ }
+
return TRUE;
}