Commit a3722bf4 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

user: Use DDE critical section exclusively for instance list protection.

parent 5ef324ee
...@@ -103,20 +103,16 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic, ...@@ -103,20 +103,16 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
TRACE("(0x%x,%p,%p,%p)\n", idInst, hszService, hszTopic, pCC); TRACE("(0x%x,%p,%p,%p)\n", idInst, hszService, hszTopic, pCC);
EnterCriticalSection(&WDML_CritSect);
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (!pInstance) if (!pInstance)
{ return NULL;
goto theEnd;
}
/* make sure this conv is never created */ /* make sure this conv is never created */
pConv = WDML_FindConv(pInstance, WDML_CLIENT_SIDE, hszService, hszTopic); pConv = WDML_FindConv(pInstance, WDML_CLIENT_SIDE, hszService, hszTopic);
if (pConv != NULL) if (pConv != NULL)
{ {
ERR("This Conv already exists: (%p)\n", pConv); ERR("This Conv already exists: (%p)\n", pConv);
goto theEnd; return NULL;
} }
/* we need to establish a conversation with /* we need to establish a conversation with
...@@ -178,14 +174,10 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic, ...@@ -178,14 +174,10 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
if (!aTpc) goto theEnd; if (!aTpc) goto theEnd;
} }
LeaveCriticalSection(&WDML_CritSect);
/* note: sent messages shall not use packing */ /* note: sent messages shall not use packing */
SendMessageTimeoutW( HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndClient, MAKELPARAM(aSrv, aTpc), SendMessageTimeoutW( HWND_BROADCAST, WM_DDE_INITIATE, (WPARAM)hwndClient, MAKELPARAM(aSrv, aTpc),
SMTO_ABORTIFHUNG, 2000, NULL ); SMTO_ABORTIFHUNG, 2000, NULL );
EnterCriticalSection(&WDML_CritSect);
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (!pInstance) if (!pInstance)
{ {
...@@ -218,7 +210,6 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic, ...@@ -218,7 +210,6 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
} }
theEnd: theEnd:
LeaveCriticalSection(&WDML_CritSect);
if (aSrv) GlobalDeleteAtom(aSrv); if (aSrv) GlobalDeleteAtom(aSrv);
if (aTpc) GlobalDeleteAtom(aTpc); if (aTpc) GlobalDeleteAtom(aTpc);
...@@ -237,7 +228,6 @@ HCONV WINAPI DdeReconnect(HCONV hConv) ...@@ -237,7 +228,6 @@ HCONV WINAPI DdeReconnect(HCONV hConv)
TRACE("(%p)\n", hConv); TRACE("(%p)\n", hConv);
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, FALSE); pConv = WDML_GetConv(hConv, FALSE);
if (pConv != NULL && (pConv->wStatus & ST_CLIENT)) if (pConv != NULL && (pConv->wStatus & ST_CLIENT))
{ {
...@@ -261,14 +251,10 @@ HCONV WINAPI DdeReconnect(HCONV hConv) ...@@ -261,14 +251,10 @@ HCONV WINAPI DdeReconnect(HCONV hConv)
aTpc = WDML_MakeAtomFromHsz(pConv->hszTopic); aTpc = WDML_MakeAtomFromHsz(pConv->hszTopic);
if (!aSrv || !aTpc) goto theEnd; if (!aSrv || !aTpc) goto theEnd;
LeaveCriticalSection(&WDML_CritSect);
/* note: sent messages shall not use packing */ /* note: sent messages shall not use packing */
ret = SendMessageW(hwndServer, WM_DDE_INITIATE, (WPARAM)hwndClient, ret = SendMessageW(hwndServer, WM_DDE_INITIATE, (WPARAM)hwndClient,
MAKELPARAM(aSrv, aTpc)); MAKELPARAM(aSrv, aTpc));
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, FALSE); pConv = WDML_GetConv(hConv, FALSE);
if (pConv == NULL) if (pConv == NULL)
{ {
...@@ -300,7 +286,6 @@ HCONV WINAPI DdeReconnect(HCONV hConv) ...@@ -300,7 +286,6 @@ HCONV WINAPI DdeReconnect(HCONV hConv)
} }
theEnd: theEnd:
LeaveCriticalSection(&WDML_CritSect);
if (aSrv) GlobalDeleteAtom(aSrv); if (aSrv) GlobalDeleteAtom(aSrv);
if (aTpc) GlobalDeleteAtom(aTpc); if (aTpc) GlobalDeleteAtom(aTpc);
...@@ -1037,12 +1022,9 @@ static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML ...@@ -1037,12 +1022,9 @@ static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML
{ {
HDDEDATA hdd; HDDEDATA hdd;
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, FALSE); pConv = WDML_GetConv(hConv, FALSE);
if (pConv == NULL) if (pConv == NULL)
{ {
LeaveCriticalSection(&WDML_CritSect);
/* conversation no longer available... return failure */ /* conversation no longer available... return failure */
return 0; return 0;
} }
...@@ -1061,13 +1043,11 @@ static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML ...@@ -1061,13 +1043,11 @@ static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML
if (ret) if (ret)
{ {
pConv->instance->lastError = hdd ? DMLERR_NO_ERROR : DMLERR_NOTPROCESSED; pConv->instance->lastError = hdd ? DMLERR_NO_ERROR : DMLERR_NOTPROCESSED;
LeaveCriticalSection(&WDML_CritSect);
return hdd; return hdd;
} }
} }
else else
{ {
LeaveCriticalSection(&WDML_CritSect);
DispatchMessageW(&msg); DispatchMessageW(&msg);
} }
} }
...@@ -1076,8 +1056,6 @@ static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML ...@@ -1076,8 +1056,6 @@ static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML
TRACE("Timeout !!\n"); TRACE("Timeout !!\n");
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, FALSE); pConv = WDML_GetConv(hConv, FALSE);
if (pConv != NULL) if (pConv != NULL)
{ {
...@@ -1096,7 +1074,6 @@ static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML ...@@ -1096,7 +1074,6 @@ static HDDEDATA WDML_SyncWaitTransactionReply(HCONV hConv, DWORD dwTimeout, WDML
pConv->instance->lastError = err; pConv->instance->lastError = err;
} }
} }
LeaveCriticalSection(&WDML_CritSect);
return 0; return 0;
} }
...@@ -1120,13 +1097,11 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS ...@@ -1120,13 +1097,11 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
return 0; return 0;
} }
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, TRUE); pConv = WDML_GetConv(hConv, TRUE);
if (pConv == NULL) if (pConv == NULL)
{ {
/* cannot set error... cannot get back to DDE instance */ /* cannot set error... cannot get back to DDE instance */
goto theError; return 0;
} }
switch (wType) switch (wType)
...@@ -1145,7 +1120,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS ...@@ -1145,7 +1120,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
if (pData) if (pData)
{ {
pConv->instance->lastError = DMLERR_INVALIDPARAMETER; pConv->instance->lastError = DMLERR_INVALIDPARAMETER;
goto theError; return 0;
} }
pXAct = WDML_ClientQueueAdvise(pConv, wType, wFmt, hszItem); pXAct = WDML_ClientQueueAdvise(pConv, wType, wFmt, hszItem);
break; break;
...@@ -1153,7 +1128,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS ...@@ -1153,7 +1128,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
if (pData) if (pData)
{ {
pConv->instance->lastError = DMLERR_INVALIDPARAMETER; pConv->instance->lastError = DMLERR_INVALIDPARAMETER;
goto theError; return 0;
} }
pXAct = WDML_ClientQueueUnadvise(pConv, wFmt, hszItem); pXAct = WDML_ClientQueueUnadvise(pConv, wFmt, hszItem);
break; break;
...@@ -1161,7 +1136,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS ...@@ -1161,7 +1136,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
if (pData) if (pData)
{ {
pConv->instance->lastError = DMLERR_INVALIDPARAMETER; pConv->instance->lastError = DMLERR_INVALIDPARAMETER;
goto theError; return 0;
} }
pXAct = WDML_ClientQueueRequest(pConv, wFmt, hszItem); pXAct = WDML_ClientQueueRequest(pConv, wFmt, hszItem);
break; break;
...@@ -1169,13 +1144,13 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS ...@@ -1169,13 +1144,13 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
FIXME("Unknown transaction type %04x\n", wType); FIXME("Unknown transaction type %04x\n", wType);
/* unknown transaction type */ /* unknown transaction type */
pConv->instance->lastError = DMLERR_INVALIDPARAMETER; pConv->instance->lastError = DMLERR_INVALIDPARAMETER;
goto theError; return 0;
} }
if (pXAct == NULL) if (pXAct == NULL)
{ {
pConv->instance->lastError = DMLERR_MEMORY_ERROR; pConv->instance->lastError = DMLERR_MEMORY_ERROR;
goto theError; return 0;
} }
WDML_QueueTransaction(pConv, pXAct); WDML_QueueTransaction(pConv, pXAct);
...@@ -1188,7 +1163,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS ...@@ -1188,7 +1163,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
WDML_UnQueueTransaction(pConv, pXAct); WDML_UnQueueTransaction(pConv, pXAct);
WDML_FreeTransaction(pConv->instance, pXAct, TRUE); WDML_FreeTransaction(pConv->instance, pXAct, TRUE);
pConv->instance->lastError = DMLERR_POSTMSG_FAILED; pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
goto theError; return 0;
} }
pXAct->dwTimeout = dwTimeout; pXAct->dwTimeout = dwTimeout;
/* FIXME: should set the app bits on *pdwResult */ /* FIXME: should set the app bits on *pdwResult */
...@@ -1202,22 +1177,9 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS ...@@ -1202,22 +1177,9 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
hDdeData = (HDDEDATA)1; hDdeData = (HDDEDATA)1;
} }
else else
{ hDdeData = WDML_SyncWaitTransactionReply(hConv, dwTimeout, pXAct, pdwResult);
DWORD count, i;
count = WDML_CritSect.RecursionCount;
for (i = 0; i < count; i++)
LeaveCriticalSection(&WDML_CritSect);
hDdeData = WDML_SyncWaitTransactionReply((HCONV)pConv, dwTimeout, pXAct, pdwResult);
for (i = 0; i < count; i++)
EnterCriticalSection(&WDML_CritSect);
}
LeaveCriticalSection(&WDML_CritSect);
return hDdeData; return hDdeData;
theError:
LeaveCriticalSection(&WDML_CritSect);
return 0;
} }
/***************************************************************** /*****************************************************************
...@@ -1231,7 +1193,6 @@ BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction ...@@ -1231,7 +1193,6 @@ BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction
TRACE("(%08x,%p,%08x);\n", idInst, hConv, idTransaction); TRACE("(%08x,%p,%08x);\n", idInst, hConv, idTransaction);
EnterCriticalSection(&WDML_CritSect);
if ((pInstance = WDML_GetInstance(idInst))) if ((pInstance = WDML_GetInstance(idInst)))
{ {
if (hConv) if (hConv)
...@@ -1265,7 +1226,6 @@ BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction ...@@ -1265,7 +1226,6 @@ BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction
} }
} }
} }
LeaveCriticalSection(&WDML_CritSect);
return TRUE; return TRUE;
} }
...@@ -1336,8 +1296,6 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA ...@@ -1336,8 +1296,6 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
if (iMsg >= WM_DDE_FIRST && iMsg <= WM_DDE_LAST) if (iMsg >= WM_DDE_FIRST && iMsg <= WM_DDE_LAST)
{ {
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConvFromWnd(hwnd); pConv = WDML_GetConvFromWnd(hwnd);
if (pConv) if (pConv)
...@@ -1353,7 +1311,6 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA ...@@ -1353,7 +1311,6 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
WDML_HandleReply(pConv, &msg, &hdd, NULL); WDML_HandleReply(pConv, &msg, &hdd, NULL);
} }
LeaveCriticalSection(&WDML_CritSect);
return 0; return 0;
} }
...@@ -1368,7 +1325,6 @@ BOOL WINAPI DdeDisconnect(HCONV hConv) ...@@ -1368,7 +1325,6 @@ BOOL WINAPI DdeDisconnect(HCONV hConv)
{ {
WDML_CONV* pConv = NULL; WDML_CONV* pConv = NULL;
WDML_XACT* pXAct; WDML_XACT* pXAct;
DWORD count, i;
BOOL ret = FALSE; BOOL ret = FALSE;
TRACE("(%p)\n", hConv); TRACE("(%p)\n", hConv);
...@@ -1379,7 +1335,6 @@ BOOL WINAPI DdeDisconnect(HCONV hConv) ...@@ -1379,7 +1335,6 @@ BOOL WINAPI DdeDisconnect(HCONV hConv)
return FALSE; return FALSE;
} }
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, TRUE); pConv = WDML_GetConv(hConv, TRUE);
if (pConv != NULL) if (pConv != NULL)
{ {
...@@ -1389,19 +1344,13 @@ BOOL WINAPI DdeDisconnect(HCONV hConv) ...@@ -1389,19 +1344,13 @@ BOOL WINAPI DdeDisconnect(HCONV hConv)
pXAct = WDML_ClientQueueTerminate(pConv); pXAct = WDML_ClientQueueTerminate(pConv);
if (pXAct != NULL) if (pXAct != NULL)
{ {
count = WDML_CritSect.RecursionCount;
for (i = 0; i < count; i++)
LeaveCriticalSection(&WDML_CritSect);
if (PostMessageW(pConv->hwndServer, pXAct->ddeMsg, if (PostMessageW(pConv->hwndServer, pXAct->ddeMsg,
(WPARAM)pConv->hwndClient, pXAct->lParam)) (WPARAM)pConv->hwndClient, pXAct->lParam))
{ {
WDML_SyncWaitTransactionReply(hConv, 10000, pXAct, NULL); WDML_SyncWaitTransactionReply(hConv, 10000, pXAct, NULL);
ret = TRUE; ret = TRUE;
} }
for (i = 0; i < count; i++) else
EnterCriticalSection(&WDML_CritSect);
if (!ret)
pConv->instance->lastError = DMLERR_POSTMSG_FAILED; pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
WDML_FreeTransaction(pConv->instance, pXAct, TRUE); WDML_FreeTransaction(pConv->instance, pXAct, TRUE);
...@@ -1414,7 +1363,6 @@ BOOL WINAPI DdeDisconnect(HCONV hConv) ...@@ -1414,7 +1363,6 @@ BOOL WINAPI DdeDisconnect(HCONV hConv)
} }
} }
} }
LeaveCriticalSection(&WDML_CritSect);
return ret; return ret;
} }
...@@ -1429,12 +1377,10 @@ BOOL WINAPI DdeImpersonateClient(HCONV hConv) ...@@ -1429,12 +1377,10 @@ BOOL WINAPI DdeImpersonateClient(HCONV hConv)
TRACE("(%p)\n", hConv); TRACE("(%p)\n", hConv);
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, TRUE); pConv = WDML_GetConv(hConv, TRUE);
if (pConv) if (pConv)
{ {
ret = ImpersonateDdeClientWindow(pConv->hwndClient, pConv->hwndServer); ret = ImpersonateDdeClientWindow(pConv->hwndClient, pConv->hwndServer);
} }
LeaveCriticalSection(&WDML_CritSect);
return ret; return ret;
} }
...@@ -51,13 +51,15 @@ static WDML_INSTANCE* WDML_InstanceList = NULL; ...@@ -51,13 +51,15 @@ static WDML_INSTANCE* WDML_InstanceList = NULL;
static LONG WDML_MaxInstanceID = 0; /* OK for present, have to worry about wrap-around later */ static LONG WDML_MaxInstanceID = 0; /* OK for present, have to worry about wrap-around later */
const WCHAR WDML_szEventClass[] = {'W','i','n','e','D','d','e','E','v','e','n','t','C','l','a','s','s',0}; const WCHAR WDML_szEventClass[] = {'W','i','n','e','D','d','e','E','v','e','n','t','C','l','a','s','s',0};
/* protection for instance list */
static CRITICAL_SECTION WDML_CritSect;
static CRITICAL_SECTION_DEBUG critsect_debug = static CRITICAL_SECTION_DEBUG critsect_debug =
{ {
0, 0, &WDML_CritSect, 0, 0, &WDML_CritSect,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": WDML_CritSect") } 0, 0, { (DWORD_PTR)(__FILE__ ": WDML_CritSect") }
}; };
CRITICAL_SECTION WDML_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 }; static CRITICAL_SECTION WDML_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 };
/* ================================================================ /* ================================================================
* *
...@@ -632,14 +634,11 @@ BOOL WINAPI DdeUninitialize(DWORD idInst) ...@@ -632,14 +634,11 @@ BOOL WINAPI DdeUninitialize(DWORD idInst)
TRACE("(%d)\n", idInst); TRACE("(%d)\n", idInst);
EnterCriticalSection(&WDML_CritSect);
/* First check instance /* First check instance
*/ */
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (pInstance == NULL) if (pInstance == NULL)
{ {
LeaveCriticalSection(&WDML_CritSect);
/* /*
* Needs something here to record NOT_INITIALIZED ready for DdeGetLastError * Needs something here to record NOT_INITIALIZED ready for DdeGetLastError
*/ */
...@@ -682,10 +681,10 @@ BOOL WINAPI DdeUninitialize(DWORD idInst) ...@@ -682,10 +681,10 @@ BOOL WINAPI DdeUninitialize(DWORD idInst)
for (inst = WDML_InstanceList; inst->next != pInstance; inst = inst->next); for (inst = WDML_InstanceList; inst->next != pInstance; inst = inst->next);
inst->next = pInstance->next; inst->next = pInstance->next;
} }
/* leave crit sect and release the heap entry /* release the heap entry
*/ */
HeapFree(GetProcessHeap(), 0, pInstance); HeapFree(GetProcessHeap(), 0, pInstance);
LeaveCriticalSection(&WDML_CritSect);
return TRUE; return TRUE;
} }
...@@ -706,7 +705,9 @@ void WDML_NotifyThreadDetach(void) ...@@ -706,7 +705,9 @@ void WDML_NotifyThreadDetach(void)
next = pInstance->next; next = pInstance->next;
if (pInstance->threadID == tid) if (pInstance->threadID == tid)
{ {
LeaveCriticalSection(&WDML_CritSect);
DdeUninitialize(pInstance->instanceID); DdeUninitialize(pInstance->instanceID);
EnterCriticalSection(&WDML_CritSect);
} }
} }
LeaveCriticalSection(&WDML_CritSect); LeaveCriticalSection(&WDML_CritSect);
...@@ -725,6 +726,7 @@ HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInstance, UINT uType, UINT uFmt, H ...@@ -725,6 +726,7 @@ HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInstance, UINT uType, UINT uFmt, H
if (pInstance == NULL) if (pInstance == NULL)
return NULL; return NULL;
TRACE("invoking CB%d[%p] (%x %x %p %p %p %p %lx %lx)\n", TRACE("invoking CB%d[%p] (%x %x %p %p %p %p %lx %lx)\n",
pInstance->win16 ? 16 : 32, pInstance->callback, uType, uFmt, pInstance->win16 ? 16 : 32, pInstance->callback, uType, uFmt,
hConv, hsz1, hsz2, hdata, dwData1, dwData2); hConv, hsz1, hsz2, hdata, dwData1, dwData2);
...@@ -752,6 +754,8 @@ WDML_INSTANCE* WDML_GetInstance(DWORD instId) ...@@ -752,6 +754,8 @@ WDML_INSTANCE* WDML_GetInstance(DWORD instId)
{ {
WDML_INSTANCE* pInstance; WDML_INSTANCE* pInstance;
EnterCriticalSection(&WDML_CritSect);
for (pInstance = WDML_InstanceList; pInstance != NULL; pInstance = pInstance->next) for (pInstance = WDML_InstanceList; pInstance != NULL; pInstance = pInstance->next)
{ {
if (pInstance->instanceID == instId) if (pInstance->instanceID == instId)
...@@ -761,11 +765,15 @@ WDML_INSTANCE* WDML_GetInstance(DWORD instId) ...@@ -761,11 +765,15 @@ WDML_INSTANCE* WDML_GetInstance(DWORD instId)
FIXME("Tried to get instance from wrong thread\n"); FIXME("Tried to get instance from wrong thread\n");
continue; continue;
} }
return pInstance; break;
} }
} }
TRACE("Instance entry missing\n");
return NULL; LeaveCriticalSection(&WDML_CritSect);
if (!pInstance)
WARN("Instance entry missing for id %04x\n", instId);
return pInstance;
} }
/****************************************************************** /******************************************************************
...@@ -792,8 +800,6 @@ UINT WINAPI DdeGetLastError(DWORD idInst) ...@@ -792,8 +800,6 @@ UINT WINAPI DdeGetLastError(DWORD idInst)
DWORD error_code; DWORD error_code;
WDML_INSTANCE* pInstance; WDML_INSTANCE* pInstance;
EnterCriticalSection(&WDML_CritSect);
/* First check instance /* First check instance
*/ */
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
...@@ -807,7 +813,6 @@ UINT WINAPI DdeGetLastError(DWORD idInst) ...@@ -807,7 +813,6 @@ UINT WINAPI DdeGetLastError(DWORD idInst)
pInstance->lastError = 0; pInstance->lastError = 0;
} }
LeaveCriticalSection(&WDML_CritSect);
return error_code; return error_code;
} }
...@@ -1018,8 +1023,6 @@ DWORD WINAPI DdeQueryStringA(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, INT ...@@ -1018,8 +1023,6 @@ DWORD WINAPI DdeQueryStringA(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, INT
TRACE("(%d, %p, %p, %d, %d)\n", idInst, hsz, psz, cchMax, iCodePage); TRACE("(%d, %p, %p, %d, %d)\n", idInst, hsz, psz, cchMax, iCodePage);
EnterCriticalSection(&WDML_CritSect);
/* First check instance /* First check instance
*/ */
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
...@@ -1028,7 +1031,6 @@ DWORD WINAPI DdeQueryStringA(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, INT ...@@ -1028,7 +1031,6 @@ DWORD WINAPI DdeQueryStringA(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, INT
if (iCodePage == 0) iCodePage = CP_WINANSI; if (iCodePage == 0) iCodePage = CP_WINANSI;
ret = WDML_QueryString(pInstance, hsz, psz, cchMax, iCodePage); ret = WDML_QueryString(pInstance, hsz, psz, cchMax, iCodePage);
} }
LeaveCriticalSection(&WDML_CritSect);
TRACE("returning %d (%s)\n", ret, debugstr_a(psz)); TRACE("returning %d (%s)\n", ret, debugstr_a(psz));
return ret; return ret;
...@@ -1045,8 +1047,6 @@ DWORD WINAPI DdeQueryStringW(DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, IN ...@@ -1045,8 +1047,6 @@ DWORD WINAPI DdeQueryStringW(DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, IN
TRACE("(%d, %p, %p, %d, %d)\n", idInst, hsz, psz, cchMax, iCodePage); TRACE("(%d, %p, %p, %d, %d)\n", idInst, hsz, psz, cchMax, iCodePage);
EnterCriticalSection(&WDML_CritSect);
/* First check instance /* First check instance
*/ */
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
...@@ -1055,7 +1055,6 @@ DWORD WINAPI DdeQueryStringW(DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, IN ...@@ -1055,7 +1055,6 @@ DWORD WINAPI DdeQueryStringW(DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, IN
if (iCodePage == 0) iCodePage = CP_WINUNICODE; if (iCodePage == 0) iCodePage = CP_WINUNICODE;
ret = WDML_QueryString(pInstance, hsz, psz, cchMax, iCodePage); ret = WDML_QueryString(pInstance, hsz, psz, cchMax, iCodePage);
} }
LeaveCriticalSection(&WDML_CritSect);
TRACE("returning %d (%s)\n", ret, debugstr_w(psz)); TRACE("returning %d (%s)\n", ret, debugstr_w(psz));
return ret; return ret;
...@@ -1100,8 +1099,6 @@ HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage) ...@@ -1100,8 +1099,6 @@ HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage)
TRACE("(%d,%s,%d)\n", idInst, debugstr_a(psz), codepage); TRACE("(%d,%s,%d)\n", idInst, debugstr_a(psz), codepage);
EnterCriticalSection(&WDML_CritSect);
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (pInstance) if (pInstance)
{ {
...@@ -1109,7 +1106,6 @@ HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage) ...@@ -1109,7 +1106,6 @@ HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage)
hsz = WDML_CreateString(pInstance, psz, codepage); hsz = WDML_CreateString(pInstance, psz, codepage);
} }
LeaveCriticalSection(&WDML_CritSect);
return hsz; return hsz;
} }
...@@ -1132,15 +1128,12 @@ HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage) ...@@ -1132,15 +1128,12 @@ HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage)
TRACE("(%d,%s,%d)\n", idInst, debugstr_w(psz), codepage); TRACE("(%d,%s,%d)\n", idInst, debugstr_w(psz), codepage);
EnterCriticalSection(&WDML_CritSect);
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (pInstance) if (pInstance)
{ {
if (codepage == 0) codepage = CP_WINUNICODE; if (codepage == 0) codepage = CP_WINUNICODE;
hsz = WDML_CreateString(pInstance, psz, codepage); hsz = WDML_CreateString(pInstance, psz, codepage);
} }
LeaveCriticalSection(&WDML_CritSect);
return hsz; return hsz;
} }
...@@ -1158,16 +1151,12 @@ BOOL WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz) ...@@ -1158,16 +1151,12 @@ BOOL WINAPI DdeFreeStringHandle(DWORD idInst, HSZ hsz)
TRACE("(%d,%p):\n", idInst, hsz); TRACE("(%d,%p):\n", idInst, hsz);
EnterCriticalSection(&WDML_CritSect);
/* First check instance /* First check instance
*/ */
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (pInstance) if (pInstance)
ret = WDML_DecHSZ(pInstance, hsz); ret = WDML_DecHSZ(pInstance, hsz);
LeaveCriticalSection(&WDML_CritSect);
return ret; return ret;
} }
...@@ -1185,15 +1174,12 @@ BOOL WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz) ...@@ -1185,15 +1174,12 @@ BOOL WINAPI DdeKeepStringHandle(DWORD idInst, HSZ hsz)
TRACE("(%d,%p):\n", idInst, hsz); TRACE("(%d,%p):\n", idInst, hsz);
EnterCriticalSection(&WDML_CritSect);
/* First check instance /* First check instance
*/ */
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (pInstance) if (pInstance)
ret = WDML_IncHSZ(pInstance, hsz); ret = WDML_IncHSZ(pInstance, hsz);
LeaveCriticalSection(&WDML_CritSect);
return ret; return ret;
} }
...@@ -1899,14 +1885,11 @@ BOOL WINAPI DdeEnableCallback(DWORD idInst, HCONV hConv, UINT wCmd) ...@@ -1899,14 +1885,11 @@ BOOL WINAPI DdeEnableCallback(DWORD idInst, HCONV hConv, UINT wCmd)
TRACE("(%d, %p, %04x)\n", idInst, hConv, wCmd); TRACE("(%d, %p, %04x)\n", idInst, hConv, wCmd);
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, TRUE); pConv = WDML_GetConv(hConv, TRUE);
if (pConv && pConv->instance->instanceID == idInst) if (pConv && pConv->instance->instanceID == idInst)
ret = WDML_EnableCallback(pConv, wCmd); ret = WDML_EnableCallback(pConv, wCmd);
LeaveCriticalSection(&WDML_CritSect);
return ret; return ret;
} }
...@@ -1922,16 +1905,17 @@ WDML_CONV* WDML_GetConv(HCONV hConv, BOOL checkConnected) ...@@ -1922,16 +1905,17 @@ WDML_CONV* WDML_GetConv(HCONV hConv, BOOL checkConnected)
/* FIXME: should do better checking */ /* FIXME: should do better checking */
if (pConv == NULL || pConv->magic != WDML_CONV_MAGIC) return NULL; if (pConv == NULL || pConv->magic != WDML_CONV_MAGIC) return NULL;
if (checkConnected && !(pConv->wStatus & ST_CONNECTED)) if (!pConv->instance || pConv->instance->threadID != GetCurrentThreadId())
{ {
WARN("found conv but ain't connected\n"); WARN("wrong thread ID\n");
pConv->instance->lastError = DMLERR_NO_CONV_ESTABLISHED; pConv->instance->lastError = DMLERR_INVALIDPARAMETER; /* FIXME: check */
return NULL; return NULL;
} }
if (!pConv->instance || GetCurrentThreadId() != pConv->instance->threadID)
if (checkConnected && !(pConv->wStatus & ST_CONNECTED))
{ {
WARN("wrong thread ID\n"); WARN("found conv but ain't connected\n");
pConv->instance->lastError = DMLERR_INVALIDPARAMETER; /* FIXME: check */ pConv->instance->lastError = DMLERR_NO_CONV_ESTABLISHED;
return NULL; return NULL;
} }
...@@ -1995,18 +1979,13 @@ BOOL WDML_PostAck(WDML_CONV* pConv, WDML_SIDE side, WORD appRetCode, ...@@ -1995,18 +1979,13 @@ BOOL WDML_PostAck(WDML_CONV* pConv, WDML_SIDE side, WORD appRetCode,
BOOL WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser) BOOL WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser)
{ {
WDML_CONV* pConv; WDML_CONV* pConv;
BOOL ret = TRUE;
TRACE("(%p,%x,%x)\n", hConv, id, hUser); TRACE("(%p,%x,%x)\n", hConv, id, hUser);
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, FALSE); pConv = WDML_GetConv(hConv, FALSE);
if (pConv == NULL) if (pConv == NULL)
{ return FALSE;
ret = FALSE;
goto theError;
}
if (id == QID_SYNC) if (id == QID_SYNC)
{ {
pConv->hUser = hUser; pConv->hUser = hUser;
...@@ -2023,12 +2002,10 @@ BOOL WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser) ...@@ -2023,12 +2002,10 @@ BOOL WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser)
else else
{ {
pConv->instance->lastError = DMLERR_UNFOUND_QUEUE_ID; pConv->instance->lastError = DMLERR_UNFOUND_QUEUE_ID;
ret = FALSE; return FALSE;
} }
} }
theError: return TRUE;
LeaveCriticalSection(&WDML_CritSect);
return ret;
} }
/****************************************************************** /******************************************************************
...@@ -2127,8 +2104,6 @@ UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD id, PCONVINFO lpConvInfo) ...@@ -2127,8 +2104,6 @@ UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD id, PCONVINFO lpConvInfo)
return 0; return 0;
} }
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConv(hConv, FALSE); pConv = WDML_GetConv(hConv, FALSE);
if (pConv != NULL) if (pConv != NULL)
{ {
...@@ -2145,7 +2120,7 @@ UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD id, PCONVINFO lpConvInfo) ...@@ -2145,7 +2120,7 @@ UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD id, PCONVINFO lpConvInfo)
} }
ret = 0; ret = 0;
} }
LeaveCriticalSection(&WDML_CritSect);
if (ret != 0) if (ret != 0)
memcpy(lpConvInfo, &ci, min((size_t)lpConvInfo->cb, sizeof(ci))); memcpy(lpConvInfo, &ci, min((size_t)lpConvInfo->cb, sizeof(ci)));
return ret; return ret;
......
...@@ -169,8 +169,6 @@ typedef struct tagWDML_INSTANCE ...@@ -169,8 +169,6 @@ typedef struct tagWDML_INSTANCE
WDML_LINK* links[2]; /* active links for this instance (client and server) */ WDML_LINK* links[2]; /* active links for this instance (client and server) */
} WDML_INSTANCE; } WDML_INSTANCE;
extern CRITICAL_SECTION WDML_CritSect; /* protection for instance list */
/* header for the DDE Data objects */ /* header for the DDE Data objects */
typedef struct tagDDE_DATAHANDLE_HEAD typedef struct tagDDE_DATAHANDLE_HEAD
{ {
......
...@@ -69,17 +69,13 @@ BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem) ...@@ -69,17 +69,13 @@ BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem)
TRACE("(%d,%p,%p)\n", idInst, hszTopic, hszItem); TRACE("(%d,%p,%p)\n", idInst, hszTopic, hszItem);
EnterCriticalSection(&WDML_CritSect);
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
if (pInstance == NULL || pInstance->links == NULL) if (pInstance == NULL || pInstance->links == NULL)
{ return FALSE;
goto theError;
}
atom = WDML_MakeAtomFromHsz(hszItem); atom = WDML_MakeAtomFromHsz(hszItem);
if (!atom) goto theError; if (!atom) return FALSE;
/* first compute the number of links which will trigger a message */ /* first compute the number of links which will trigger a message */
count = 0; count = 0;
...@@ -145,10 +141,9 @@ BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem) ...@@ -145,10 +141,9 @@ BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem)
} }
} }
} }
LeaveCriticalSection(&WDML_CritSect);
return TRUE; return TRUE;
theError: theError:
LeaveCriticalSection(&WDML_CritSect);
if (atom) GlobalDeleteAtom(atom); if (atom) GlobalDeleteAtom(atom);
return FALSE; return FALSE;
} }
...@@ -179,8 +174,6 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd) ...@@ -179,8 +174,6 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
TRACE("(%d,%p,%p,%x)\n", idInst, hsz1, hsz2, afCmd); TRACE("(%d,%p,%p,%x)\n", idInst, hsz1, hsz2, afCmd);
EnterCriticalSection(&WDML_CritSect);
/* First check instance /* First check instance
*/ */
pInstance = WDML_GetInstance(idInst); pInstance = WDML_GetInstance(idInst);
...@@ -188,7 +181,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd) ...@@ -188,7 +181,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
{ {
TRACE("Instance not found as initialised\n"); TRACE("Instance not found as initialised\n");
/* Nothing has been initialised - exit now ! can return TRUE since effect is the same */ /* Nothing has been initialised - exit now ! can return TRUE since effect is the same */
goto theError; return NULL;
} }
if (hsz2 != 0L) if (hsz2 != 0L)
...@@ -197,7 +190,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd) ...@@ -197,7 +190,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
*/ */
pInstance->lastError = DMLERR_INVALIDPARAMETER; pInstance->lastError = DMLERR_INVALIDPARAMETER;
WARN("Reserved parameter no-zero !!\n"); WARN("Reserved parameter no-zero !!\n");
goto theError; return NULL;
} }
if (hsz1 == 0 && !(afCmd & DNS_UNREGISTER)) if (hsz1 == 0 && !(afCmd & DNS_UNREGISTER))
{ {
...@@ -206,7 +199,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd) ...@@ -206,7 +199,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
*/ */
TRACE("General unregister unexpected flags\n"); TRACE("General unregister unexpected flags\n");
pInstance->lastError = DMLERR_INVALIDPARAMETER; pInstance->lastError = DMLERR_INVALIDPARAMETER;
goto theError; return NULL;
} }
switch (afCmd & (DNS_REGISTER | DNS_UNREGISTER)) switch (afCmd & (DNS_REGISTER | DNS_UNREGISTER))
...@@ -217,7 +210,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd) ...@@ -217,7 +210,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
{ {
ERR("Trying to register already registered service!\n"); ERR("Trying to register already registered service!\n");
pInstance->lastError = DMLERR_DLL_USAGE; pInstance->lastError = DMLERR_DLL_USAGE;
goto theError; return NULL;
} }
TRACE("Adding service name\n"); TRACE("Adding service name\n");
...@@ -244,11 +237,9 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd) ...@@ -244,11 +237,9 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
RegisterClassExW(&wndclass); RegisterClassExW(&wndclass);
LeaveCriticalSection(&WDML_CritSect);
hwndServer = CreateWindowW(szServerNameClass, NULL, hwndServer = CreateWindowW(szServerNameClass, NULL,
WS_POPUP, 0, 0, 0, 0, WS_POPUP, 0, 0, 0, 0,
0, 0, 0, 0); 0, 0, 0, 0);
EnterCriticalSection(&WDML_CritSect);
SetWindowLongPtrW(hwndServer, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance); SetWindowLongPtrW(hwndServer, GWL_WDML_INSTANCE, (ULONG_PTR)pInstance);
SetWindowLongPtrW(hwndServer, GWL_WDML_SERVER, (ULONG_PTR)pServer); SetWindowLongPtrW(hwndServer, GWL_WDML_SERVER, (ULONG_PTR)pServer);
...@@ -285,19 +276,14 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd) ...@@ -285,19 +276,14 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
/* trying to filter where no service names !! /* trying to filter where no service names !!
*/ */
pInstance->lastError = DMLERR_DLL_USAGE; pInstance->lastError = DMLERR_DLL_USAGE;
goto theError; return NULL;
} }
else else
{ {
pServer->filterOn = (afCmd & DNS_FILTERON) != 0; pServer->filterOn = (afCmd & DNS_FILTERON) != 0;
} }
} }
LeaveCriticalSection(&WDML_CritSect);
return (HDDEDATA)TRUE; return (HDDEDATA)TRUE;
theError:
LeaveCriticalSection(&WDML_CritSect);
return FALSE;
} }
/****************************************************************** /******************************************************************
...@@ -998,13 +984,11 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w ...@@ -998,13 +984,11 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
if (iMsg == WM_DESTROY) if (iMsg == WM_DESTROY)
{ {
EnterCriticalSection(&WDML_CritSect);
pConv = WDML_GetConvFromWnd(hwndServer); pConv = WDML_GetConvFromWnd(hwndServer);
if (pConv && !(pConv->wStatus & ST_TERMINATED)) if (pConv && !(pConv->wStatus & ST_TERMINATED))
{ {
WDML_ServerHandleTerminate(pConv, NULL); WDML_ServerHandleTerminate(pConv, NULL);
} }
LeaveCriticalSection(&WDML_CritSect);
} }
if (iMsg < WM_DDE_FIRST || iMsg > WM_DDE_LAST) if (iMsg < WM_DDE_FIRST || iMsg > WM_DDE_LAST)
{ {
...@@ -1012,25 +996,23 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w ...@@ -1012,25 +996,23 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
DefWindowProcA(hwndServer, iMsg, wParam, lParam); DefWindowProcA(hwndServer, iMsg, wParam, lParam);
} }
EnterCriticalSection(&WDML_CritSect);
pInstance = WDML_GetInstanceFromWnd(hwndServer); pInstance = WDML_GetInstanceFromWnd(hwndServer);
pConv = WDML_GetConvFromWnd(hwndServer); pConv = WDML_GetConvFromWnd(hwndServer);
if (!pConv) if (!pConv)
{ {
ERR("Got a message (%x) on a not known conversation, dropping request\n", iMsg); ERR("Got a message (%x) on a not known conversation, dropping request\n", iMsg);
goto theError; return 0;
} }
if (pConv->hwndClient != WIN_GetFullHandle( (HWND)wParam ) || pConv->hwndServer != hwndServer) if (pConv->hwndClient != WIN_GetFullHandle( (HWND)wParam ) || pConv->hwndServer != hwndServer)
{ {
ERR("mismatch between C/S windows and converstation\n"); ERR("mismatch between C/S windows and converstation\n");
goto theError; return 0;
} }
if (pConv->instance != pInstance || pConv->instance == NULL) if (pConv->instance != pInstance || pConv->instance == NULL)
{ {
ERR("mismatch in instances\n"); ERR("mismatch in instances\n");
goto theError; return 0;
} }
switch (iMsg) switch (iMsg)
...@@ -1083,7 +1065,6 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w ...@@ -1083,7 +1065,6 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
WDML_FreeTransaction(pInstance, pXAct, TRUE); WDML_FreeTransaction(pInstance, pXAct, TRUE);
} }
} }
theError:
LeaveCriticalSection(&WDML_CritSect);
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment