Commit 7266da3e authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Handle CBR_BLOCK in EXECUTE and ADVISE DDE transactions.

parent e70f3e85
...@@ -166,7 +166,7 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic, ...@@ -166,7 +166,7 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
hwndClient = CreateWindowA(WDML_szClientConvClassA, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0); hwndClient = CreateWindowA(WDML_szClientConvClassA, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0);
} }
SetWindowLongA(hwndClient, GWL_WDML_INSTANCE, (DWORD)pInstance); SetWindowLongPtrW(hwndClient, GWL_WDML_INSTANCE, (LONG_PTR)pInstance);
if (hszService) if (hszService)
{ {
...@@ -1271,6 +1271,8 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA ...@@ -1271,6 +1271,8 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
WDML_CONV* pConv = NULL; WDML_CONV* pConv = NULL;
HSZ hszSrv, hszTpc; HSZ hszSrv, hszTpc;
TRACE("%p %04x %08x %08lx\n", hwnd, iMsg, wParam , lParam);
if (iMsg == WM_DDE_ACK && if (iMsg == WM_DDE_ACK &&
/* in the initial WM_INITIATE sendmessage */ /* in the initial WM_INITIATE sendmessage */
((pConv = WDML_GetConvFromWnd(hwnd)) == NULL || pConv->wStatus == XST_INIT1)) ((pConv = WDML_GetConvFromWnd(hwnd)) == NULL || pConv->wStatus == XST_INIT1))
......
...@@ -173,7 +173,7 @@ extern CRITICAL_SECTION WDML_CritSect; /* protection for instance list */ ...@@ -173,7 +173,7 @@ 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
{ {
short cfFormat; WORD cfFormat;
WORD bAppOwned; WORD bAppOwned;
} DDE_DATAHANDLE_HEAD; } DDE_DATAHANDLE_HEAD;
......
...@@ -1277,9 +1277,13 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD c ...@@ -1277,9 +1277,13 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD c
DDE_DATAHANDLE_HEAD* pDdh; DDE_DATAHANDLE_HEAD* pDdh;
WCHAR psz[MAX_BUFFER_LEN]; WCHAR psz[MAX_BUFFER_LEN];
GetAtomNameW(HSZ2ATOM(hszItem), psz, MAX_BUFFER_LEN); if (!GetAtomNameW(HSZ2ATOM(hszItem), psz, MAX_BUFFER_LEN))
{
psz[0] = HSZ2ATOM(hszItem);
psz[1] = 0;
}
TRACE("(%ld,%p,cb %ld, cbOff %ld,%p <%s>,%x,%x)\n", TRACE("(%ld,%p,cb %ld, cbOff %ld,%p <%s>,fmt %04x,%x)\n",
idInst, pSrc, cb, cbOff, hszItem, debugstr_w(psz), wFmt, afCmd); idInst, pSrc, cb, cbOff, hszItem, debugstr_w(psz), wFmt, afCmd);
if (afCmd != 0 && afCmd != HDATA_APPOWNED) if (afCmd != 0 && afCmd != HDATA_APPOWNED)
...@@ -1309,6 +1313,7 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD c ...@@ -1309,6 +1313,7 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD c
} }
GlobalUnlock(hMem); GlobalUnlock(hMem);
TRACE("=> %p\n", hMem);
return (HDDEDATA)hMem; return (HDDEDATA)hMem;
} }
...@@ -1416,7 +1421,7 @@ LPBYTE WINAPI DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize) ...@@ -1416,7 +1421,7 @@ LPBYTE WINAPI DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize)
{ {
*pcbDataSize = GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD); *pcbDataSize = GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD);
} }
TRACE("=> %p (%lu)\n", pDdh + 1, GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD)); TRACE("=> %p (%lu) fmt %04x\n", pDdh + 1, GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD), pDdh->cfFormat);
return (LPBYTE)(pDdh + 1); return (LPBYTE)(pDdh + 1);
} }
...@@ -1491,8 +1496,8 @@ HDDEDATA WDML_Global2DataHandle(HGLOBAL hMem, WINE_DDEHEAD* p) ...@@ -1491,8 +1496,8 @@ HDDEDATA WDML_Global2DataHandle(HGLOBAL hMem, WINE_DDEHEAD* p)
switch (pDd->cfFormat) switch (pDd->cfFormat)
{ {
default: default:
FIXME("Unsupported format (%d) for data... assuming raw information\n", FIXME("Unsupported format (%04x) for data %p, passing raw information\n",
pDd->cfFormat); pDd->cfFormat, hMem);
/* fall thru */ /* fall thru */
case 0: case 0:
case CF_TEXT: case CF_TEXT:
...@@ -1550,7 +1555,8 @@ HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease, ...@@ -1550,7 +1555,8 @@ HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease,
switch (pDdh->cfFormat) switch (pDdh->cfFormat)
{ {
default: default:
FIXME("Unsupported format (%d) for data... passing raw information\n", pDdh->cfFormat); FIXME("Unsupported format (%04x) for data %p, passing raw information\n",
pDdh->cfFormat, hDdeData);
/* fall thru */ /* fall thru */
case 0: case 0:
case CF_TEXT: case CF_TEXT:
......
...@@ -562,7 +562,7 @@ static WDML_XACT* WDML_ServerQueueRequest(WDML_CONV* pConv, LPARAM lParam) ...@@ -562,7 +562,7 @@ static WDML_XACT* WDML_ServerQueueRequest(WDML_CONV* pConv, LPARAM lParam)
static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pXAct) static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pXAct)
{ {
HDDEDATA hDdeData = 0; HDDEDATA hDdeData = 0;
WDML_QUEUE_STATE ret = WDML_QS_HANDLED; BOOL fAck = TRUE;
if (!(pConv->instance->CBFflags & CBF_FAIL_REQUESTS)) if (!(pConv->instance->CBFflags & CBF_FAIL_REQUESTS))
{ {
...@@ -574,12 +574,13 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX ...@@ -574,12 +574,13 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX
switch ((ULONG_PTR)hDdeData) switch ((ULONG_PTR)hDdeData)
{ {
case 0: case 0:
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, FALSE, pXAct->atom, TRACE("No data returned from the Callback\n");
pXAct->lParam, WM_DDE_REQUEST); fAck = FALSE;
break; break;
case (ULONG_PTR)CBR_BLOCK: case (ULONG_PTR)CBR_BLOCK:
ret = WDML_QS_BLOCK; return WDML_QS_BLOCK;
break;
default: default:
{ {
HGLOBAL hMem = WDML_DataHandle2Global(hDdeData, TRUE, FALSE, FALSE, FALSE); HGLOBAL hMem = WDML_DataHandle2Global(hDdeData, TRUE, FALSE, FALSE, FALSE);
...@@ -589,12 +590,17 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX ...@@ -589,12 +590,17 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX
{ {
DdeFreeDataHandle(hDdeData); DdeFreeDataHandle(hDdeData);
GlobalFree(hMem); GlobalFree(hMem);
fAck = FALSE;
} }
} }
break; break;
} }
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, fAck, pXAct->atom, pXAct->lParam, WM_DDE_REQUEST);
WDML_DecHSZ(pConv->instance, pXAct->hszItem); WDML_DecHSZ(pConv->instance, pXAct->hszItem);
return ret;
return WDML_QS_HANDLED;
} }
/****************************************************************** /******************************************************************
...@@ -633,8 +639,8 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA ...@@ -633,8 +639,8 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA
UINT uType; UINT uType;
WDML_LINK* pLink; WDML_LINK* pLink;
DDEADVISE* pDdeAdvise; DDEADVISE* pDdeAdvise;
HDDEDATA hDdeData; HDDEDATA hDdeData = 0;
BOOL fAck; BOOL fAck = TRUE;
pDdeAdvise = (DDEADVISE*)GlobalLock(pXAct->hMem); pDdeAdvise = (DDEADVISE*)GlobalLock(pXAct->hMem);
uType = XTYP_ADVSTART | uType = XTYP_ADVSTART |
...@@ -646,15 +652,18 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA ...@@ -646,15 +652,18 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA
hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_ADVSTART, pDdeAdvise->cfFormat, hDdeData = WDML_InvokeCallback(pConv->instance, XTYP_ADVSTART, pDdeAdvise->cfFormat,
(HCONV)pConv, pConv->hszTopic, pXAct->hszItem, 0, 0, 0); (HCONV)pConv, pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
} }
else
{
hDdeData = 0;
}
if ((UINT)hDdeData) switch ((ULONG_PTR)hDdeData)
{ {
fAck = TRUE; case 0:
TRACE("No data returned from the Callback\n");
fAck = FALSE;
break;
case (ULONG_PTR)CBR_BLOCK:
return WDML_QS_BLOCK;
default:
/* billx: first to see if the link is already created. */ /* billx: first to see if the link is already created. */
pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE, pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
pXAct->hszItem, TRUE, pDdeAdvise->cfFormat); pXAct->hszItem, TRUE, pDdeAdvise->cfFormat);
...@@ -670,11 +679,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA ...@@ -670,11 +679,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA
WDML_AddLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE, WDML_AddLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
uType, pXAct->hszItem, pDdeAdvise->cfFormat); uType, pXAct->hszItem, pDdeAdvise->cfFormat);
} }
} break;
else
{
TRACE("No data returned from the Callback\n");
fAck = FALSE;
} }
GlobalUnlock(pXAct->hMem); GlobalUnlock(pXAct->hMem);
...@@ -792,8 +797,11 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX ...@@ -792,8 +797,11 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX
pConv->hszTopic, 0, hDdeData, 0L, 0L); pConv->hszTopic, 0, hDdeData, 0L, 0L);
} }
switch ((UINT)hDdeData) switch ((ULONG_PTR)hDdeData)
{ {
case (ULONG_PTR)CBR_BLOCK:
return WDML_QS_BLOCK;
case DDE_FACK: case DDE_FACK:
fAck = TRUE; fAck = TRUE;
break; break;
...@@ -801,7 +809,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX ...@@ -801,7 +809,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX
fBusy = TRUE; fBusy = TRUE;
break; break;
default: default:
WARN("Bad result code\n"); FIXME("Unsupported returned value %p\n", hDdeData);
/* fall through */ /* fall through */
case DDE_FNOTPROCESSED: case DDE_FNOTPROCESSED:
break; break;
...@@ -985,6 +993,8 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w ...@@ -985,6 +993,8 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
WDML_CONV* pConv; WDML_CONV* pConv;
WDML_XACT* pXAct = NULL; WDML_XACT* pXAct = NULL;
TRACE("%p %04x %08x %08lx\n", hwndServer, iMsg, wParam , lParam);
if (iMsg == WM_DESTROY) if (iMsg == WM_DESTROY)
{ {
EnterCriticalSection(&WDML_CritSect); EnterCriticalSection(&WDML_CritSect);
......
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