summaryrefslogtreecommitdiff
path: root/plugins/SecureIM
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/SecureIM')
-rw-r--r--plugins/SecureIM/src/commonheaders.cpp2
-rw-r--r--plugins/SecureIM/src/commonheaders.h2
-rw-r--r--plugins/SecureIM/src/crypt_lists.cpp3
-rw-r--r--plugins/SecureIM/src/crypt_misc.cpp9
-rw-r--r--plugins/SecureIM/src/main.cpp2
5 files changed, 6 insertions, 12 deletions
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp
index 28e8dc4e52..260cac63e1 100644
--- a/plugins/SecureIM/src/commonheaders.cpp
+++ b/plugins/SecureIM/src/commonheaders.cpp
@@ -21,7 +21,7 @@ BOOL bGPGloaded = false, bGPGkeyrings = false, bSavePass = false;
BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM;
BYTE bPGP, bGPG;
DWORD iCoreVersion = 0;
-CRITICAL_SECTION localQueueMutex;
+mir_cs localQueueMutex;
LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *szSetting)
{
diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h
index 7d5d182983..22ac92ebc3 100644
--- a/plugins/SecureIM/src/commonheaders.h
+++ b/plugins/SecureIM/src/commonheaders.h
@@ -83,7 +83,7 @@ extern BOOL bGPGloaded, bGPGkeyrings, bSavePass;
extern BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM;
extern BYTE bPGP, bGPG;
extern DWORD iCoreVersion;
-extern CRITICAL_SECTION localQueueMutex;
+extern mir_cs localQueueMutex;
__forceinline int SendBroadcast(MCONTACT hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp
index e15f612b35..c4914de114 100644
--- a/plugins/SecureIM/src/crypt_lists.cpp
+++ b/plugins/SecureIM/src/crypt_lists.cpp
@@ -167,7 +167,7 @@ void addMsg2Queue(pUinKey ptr, WPARAM wParam, LPSTR szMsg)
pWM ptrMessage;
- EnterCriticalSection(&localQueueMutex);
+ mir_cslock lck(localQueueMutex);
if (ptr->msgQueue == NULL) {
// create new
@@ -195,7 +195,6 @@ void addMsg2Queue(pUinKey ptr, WPARAM wParam, LPSTR szMsg)
}
else ptrMessage->Message = mir_strdup(szMsg);
- LeaveCriticalSection(&localQueueMutex);
}
void getContactNameA(MCONTACT hContact, LPSTR szName)
diff --git a/plugins/SecureIM/src/crypt_misc.cpp b/plugins/SecureIM/src/crypt_misc.cpp
index 4c51d678cf..b43c516716 100644
--- a/plugins/SecureIM/src/crypt_misc.cpp
+++ b/plugins/SecureIM/src/crypt_misc.cpp
@@ -18,7 +18,7 @@ static void sttWaitForExchange(LPVOID param)
// if keyexchange failed or timeout
if (ptr->waitForExchange == 1 || ptr->waitForExchange == 3) { // протухло - отправляем незашифрованно, если надо
if (ptr->msgQueue && msgbox1(0, sim104, MODULENAME, MB_YESNO | MB_ICONQUESTION) == IDYES) {
- EnterCriticalSection(&localQueueMutex);
+ mir_cslock lck(localQueueMutex);
ptr->sendQueue = true;
pWM ptrMessage = ptr->msgQueue;
while (ptrMessage) {
@@ -33,13 +33,12 @@ static void sttWaitForExchange(LPVOID param)
}
ptr->msgQueue = NULL;
ptr->sendQueue = false;
- LeaveCriticalSection(&localQueueMutex);
}
ptr->waitForExchange = 0;
ShowStatusIconNotify(ptr->hContact);
}
else if (ptr->waitForExchange == 2) { // дослать очередь через установленное соединение
- EnterCriticalSection(&localQueueMutex);
+ mir_cslock lck(localQueueMutex);
// we need to resend last send back message with new crypto Key
pWM ptrMessage = ptr->msgQueue;
while (ptrMessage) {
@@ -54,10 +53,9 @@ static void sttWaitForExchange(LPVOID param)
}
ptr->msgQueue = NULL;
ptr->waitForExchange = 0;
- LeaveCriticalSection(&localQueueMutex);
}
else if (ptr->waitForExchange == 0) { // очистить очередь
- EnterCriticalSection(&localQueueMutex);
+ mir_cslock lck(localQueueMutex);
// we need to resend last send back message with new crypto Key
pWM ptrMessage = ptr->msgQueue;
while (ptrMessage) {
@@ -67,7 +65,6 @@ static void sttWaitForExchange(LPVOID param)
mir_free(tmp);
}
ptr->msgQueue = NULL;
- LeaveCriticalSection(&localQueueMutex);
}
}
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index 8abf787e46..a70e7c6611 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -308,7 +308,6 @@ extern "C" __declspec(dllexport) int __cdecl Load(void)
mir_getLP(&pluginInfoEx);
DisableThreadLibraryCalls(g_hInst);
- InitializeCriticalSection(&localQueueMutex);
char temp[MAX_PATH];
GetTempPath(sizeof(temp), temp);
@@ -389,7 +388,6 @@ extern "C" __declspec(dllexport) int __cdecl Load(void)
extern "C" __declspec(dllexport) int __cdecl Unload()
{
- DeleteCriticalSection(&localQueueMutex);
freelib();
return 0;
}