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,
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)
{
......@@ -1271,6 +1271,8 @@ static LRESULT CALLBACK WDML_ClientProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPA
WDML_CONV* pConv = NULL;
HSZ hszSrv, hszTpc;
TRACE("%p %04x %08x %08lx\n", hwnd, iMsg, wParam , lParam);
if (iMsg == WM_DDE_ACK &&
/* in the initial WM_INITIATE sendmessage */
((pConv = WDML_GetConvFromWnd(hwnd)) == NULL || pConv->wStatus == XST_INIT1))
......
......@@ -173,7 +173,7 @@ extern CRITICAL_SECTION WDML_CritSect; /* protection for instance list */
/* header for the DDE Data objects */
typedef struct tagDDE_DATAHANDLE_HEAD
{
short cfFormat;
WORD cfFormat;
WORD bAppOwned;
} DDE_DATAHANDLE_HEAD;
......
......@@ -1277,9 +1277,13 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD c
DDE_DATAHANDLE_HEAD* pDdh;
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);
if (afCmd != 0 && afCmd != HDATA_APPOWNED)
......@@ -1309,6 +1313,7 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD c
}
GlobalUnlock(hMem);
TRACE("=> %p\n", hMem);
return (HDDEDATA)hMem;
}
......@@ -1416,7 +1421,7 @@ LPBYTE WINAPI DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize)
{
*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);
}
......@@ -1491,8 +1496,8 @@ HDDEDATA WDML_Global2DataHandle(HGLOBAL hMem, WINE_DDEHEAD* p)
switch (pDd->cfFormat)
{
default:
FIXME("Unsupported format (%d) for data... assuming raw information\n",
pDd->cfFormat);
FIXME("Unsupported format (%04x) for data %p, passing raw information\n",
pDd->cfFormat, hMem);
/* fall thru */
case 0:
case CF_TEXT:
......@@ -1550,7 +1555,8 @@ HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease,
switch (pDdh->cfFormat)
{
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 */
case 0:
case CF_TEXT:
......
......@@ -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)
{
HDDEDATA hDdeData = 0;
WDML_QUEUE_STATE ret = WDML_QS_HANDLED;
BOOL fAck = TRUE;
if (!(pConv->instance->CBFflags & CBF_FAIL_REQUESTS))
{
......@@ -574,12 +574,13 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX
switch ((ULONG_PTR)hDdeData)
{
case 0:
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, FALSE, pXAct->atom,
pXAct->lParam, WM_DDE_REQUEST);
TRACE("No data returned from the Callback\n");
fAck = FALSE;
break;
case (ULONG_PTR)CBR_BLOCK:
ret = WDML_QS_BLOCK;
break;
return WDML_QS_BLOCK;
default:
{
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
{
DdeFreeDataHandle(hDdeData);
GlobalFree(hMem);
fAck = FALSE;
}
}
break;
}
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, fAck, pXAct->atom, pXAct->lParam, WM_DDE_REQUEST);
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
UINT uType;
WDML_LINK* pLink;
DDEADVISE* pDdeAdvise;
HDDEDATA hDdeData;
BOOL fAck;
HDDEDATA hDdeData = 0;
BOOL fAck = TRUE;
pDdeAdvise = (DDEADVISE*)GlobalLock(pXAct->hMem);
uType = XTYP_ADVSTART |
......@@ -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,
(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. */
pLink = WDML_FindLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
pXAct->hszItem, TRUE, pDdeAdvise->cfFormat);
......@@ -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,
uType, pXAct->hszItem, pDdeAdvise->cfFormat);
}
}
else
{
TRACE("No data returned from the Callback\n");
fAck = FALSE;
break;
}
GlobalUnlock(pXAct->hMem);
......@@ -792,8 +797,11 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX
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:
fAck = TRUE;
break;
......@@ -801,7 +809,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX
fBusy = TRUE;
break;
default:
WARN("Bad result code\n");
FIXME("Unsupported returned value %p\n", hDdeData);
/* fall through */
case DDE_FNOTPROCESSED:
break;
......@@ -985,6 +993,8 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
WDML_CONV* pConv;
WDML_XACT* pXAct = NULL;
TRACE("%p %04x %08x %08lx\n", hwndServer, iMsg, wParam , lParam);
if (iMsg == WM_DESTROY)
{
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