user: Set DDE errors in some failing cases.

This commit is contained in:
Dmitry Timoshkov 2006-11-15 21:21:44 +08:00 committed by Alexandre Julliard
parent 4b292b0cb5
commit 5ef324ee89
3 changed files with 16 additions and 4 deletions

View File

@ -1166,7 +1166,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
pXAct = WDML_ClientQueueRequest(pConv, wFmt, hszItem);
break;
default:
FIXME("Unknown transation\n");
FIXME("Unknown transaction type %04x\n", wType);
/* unknown transaction type */
pConv->instance->lastError = DMLERR_INVALIDPARAMETER;
goto theError;
@ -1187,6 +1187,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
pConv->wStatus &= ~ST_CONNECTED;
WDML_UnQueueTransaction(pConv, pXAct);
WDML_FreeTransaction(pConv->instance, pXAct, TRUE);
pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
goto theError;
}
pXAct->dwTimeout = dwTimeout;
@ -1393,10 +1394,16 @@ BOOL WINAPI DdeDisconnect(HCONV hConv)
LeaveCriticalSection(&WDML_CritSect);
if (PostMessageW(pConv->hwndServer, pXAct->ddeMsg,
(WPARAM)pConv->hwndClient, pXAct->lParam))
{
WDML_SyncWaitTransactionReply(hConv, 10000, pXAct, NULL);
ret = TRUE;
}
for (i = 0; i < count; i++)
EnterCriticalSection(&WDML_CritSect);
ret = TRUE;
if (!ret)
pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
WDML_FreeTransaction(pConv->instance, pXAct, TRUE);
/* still have to destroy data assosiated with conversation */
WDML_RemoveConv(pConv, WDML_CLIENT_SIDE);

View File

@ -1924,12 +1924,14 @@ WDML_CONV* WDML_GetConv(HCONV hConv, BOOL checkConnected)
if (checkConnected && !(pConv->wStatus & ST_CONNECTED))
{
FIXME("found conv but ain't connected\n");
WARN("found conv but ain't connected\n");
pConv->instance->lastError = DMLERR_NO_CONV_ESTABLISHED;
return NULL;
}
if (!pConv->instance || GetCurrentThreadId() != pConv->instance->threadID)
{
FIXME("wrong thread ID\n");
WARN("wrong thread ID\n");
pConv->instance->lastError = DMLERR_INVALIDPARAMETER; /* FIXME: check */
return NULL;
}
@ -1980,6 +1982,7 @@ BOOL WDML_PostAck(WDML_CONV* pConv, WDML_SIDE side, WORD appRetCode,
if (!PostMessageW(to, WM_DDE_ACK, (WPARAM)from, lParam))
{
pConv->wStatus &= ~ST_CONNECTED;
pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
FreeDDElParam(WM_DDE_ACK, lParam);
return FALSE;
}

View File

@ -136,6 +136,7 @@ BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem)
{
ERR("post message failed\n");
pConv->wStatus &= ~ST_CONNECTED;
pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
if (!WDML_IsAppOwned(hDdeData)) DdeFreeDataHandle(hDdeData);
GlobalFree(hItemData);
goto theError;
@ -587,6 +588,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX
ReuseDDElParam(pXAct->lParam, WM_DDE_REQUEST, WM_DDE_DATA,
(UINT_PTR)hMem, (UINT_PTR)pXAct->atom)))
{
pConv->instance->lastError = DMLERR_POSTMSG_FAILED;
DdeFreeDataHandle(hDdeData);
GlobalFree(hMem);
fAck = FALSE;