Expect multiple DNS_ flags.
Partially implemented DdeEnableCallback. Call a callback with XTYP_CONNECT_CONFIRM after an accepted XTYP_CONNECT. Added traces, clarify data types, other cosmetics.
This commit is contained in:
parent
33c2ad5712
commit
37d3996355
|
@ -115,7 +115,7 @@ HCONV WINAPI DdeConnect(DWORD idInst, HSZ hszService, HSZ hszTopic,
|
|||
pConv = WDML_FindConv(pInstance, WDML_CLIENT_SIDE, hszService, hszTopic);
|
||||
if (pConv != NULL)
|
||||
{
|
||||
ERR("This Conv already exists: (0x%lx)\n", (DWORD)pConv);
|
||||
ERR("This Conv already exists: (%p)\n", pConv);
|
||||
goto theEnd;
|
||||
}
|
||||
|
||||
|
@ -234,6 +234,8 @@ HCONV WINAPI DdeReconnect(HCONV hConv)
|
|||
WDML_CONV* pNewConv = NULL;
|
||||
ATOM aSrv = 0, aTpc = 0;
|
||||
|
||||
TRACE("(%p)\n", hConv);
|
||||
|
||||
EnterCriticalSection(&WDML_CritSect);
|
||||
pConv = WDML_GetConv(hConv, FALSE);
|
||||
if (pConv != NULL && (pConv->wStatus & ST_CLIENT))
|
||||
|
@ -339,7 +341,7 @@ static WDML_XACT* WDML_ClientQueueAdvise(WDML_CONV* pConv, UINT wType, UINT wFmt
|
|||
pDdeAdvise->cfFormat = wFmt;
|
||||
GlobalUnlock(pXAct->hMem);
|
||||
|
||||
pXAct->lParam = PackDDElParam(WM_DDE_ADVISE, (UINT)pXAct->hMem, atom);
|
||||
pXAct->lParam = PackDDElParam(WM_DDE_ADVISE, (UINT_PTR)pXAct->hMem, atom);
|
||||
|
||||
return pXAct;
|
||||
}
|
||||
|
@ -352,7 +354,7 @@ static WDML_XACT* WDML_ClientQueueAdvise(WDML_CONV* pConv, UINT wType, UINT wFmt
|
|||
static WDML_QUEUE_STATE WDML_HandleAdviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct)
|
||||
{
|
||||
DDEACK ddeAck;
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
HSZ hsz;
|
||||
|
||||
if (msg->message != WM_DDE_ACK || WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer)
|
||||
|
@ -437,7 +439,7 @@ static WDML_XACT* WDML_ClientQueueUnadvise(WDML_CONV* pConv, UINT wFmt, HSZ hszI
|
|||
static WDML_QUEUE_STATE WDML_HandleUnadviseReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct)
|
||||
{
|
||||
DDEACK ddeAck;
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
HSZ hsz;
|
||||
|
||||
if (msg->message != WM_DDE_ACK || WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer)
|
||||
|
@ -509,7 +511,7 @@ static WDML_QUEUE_STATE WDML_HandleRequestReply(WDML_CONV* pConv, MSG* msg, WDML
|
|||
{
|
||||
DDEACK ddeAck;
|
||||
WINE_DDEHEAD wdh;
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
HSZ hsz;
|
||||
|
||||
if (WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer)
|
||||
|
@ -530,7 +532,7 @@ static WDML_QUEUE_STATE WDML_HandleRequestReply(WDML_CONV* pConv, MSG* msg, WDML
|
|||
|
||||
case WM_DDE_DATA:
|
||||
UnpackDDElParam(WM_DDE_DATA, msg->lParam, &uiLo, &uiHi);
|
||||
TRACE("Got the result (%08lx)\n", (DWORD)uiLo);
|
||||
TRACE("Got the result (%08x)\n", uiLo);
|
||||
|
||||
hsz = WDML_MakeHszFromAtom(pConv->instance, uiHi);
|
||||
|
||||
|
@ -672,7 +674,7 @@ static WDML_XACT* WDML_ClientQueueExecute(WDML_CONV* pConv, LPCVOID pData, DWORD
|
|||
static WDML_QUEUE_STATE WDML_HandleExecuteReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct)
|
||||
{
|
||||
DDEACK ddeAck;
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
|
||||
if (msg->message != WM_DDE_ACK || WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer)
|
||||
{
|
||||
|
@ -735,7 +737,7 @@ static WDML_XACT* WDML_ClientQueuePoke(WDML_CONV* pConv, LPCVOID pData, DWORD cb
|
|||
}
|
||||
}
|
||||
|
||||
pXAct->lParam = PackDDElParam(WM_DDE_POKE, (UINT)pXAct->hMem, atom);
|
||||
pXAct->lParam = PackDDElParam(WM_DDE_POKE, (UINT_PTR)pXAct->hMem, atom);
|
||||
|
||||
return pXAct;
|
||||
}
|
||||
|
@ -748,7 +750,7 @@ static WDML_XACT* WDML_ClientQueuePoke(WDML_CONV* pConv, LPCVOID pData, DWORD cb
|
|||
static WDML_QUEUE_STATE WDML_HandlePokeReply(WDML_CONV* pConv, MSG* msg, WDML_XACT* pXAct)
|
||||
{
|
||||
DDEACK ddeAck;
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
HSZ hsz;
|
||||
|
||||
if (msg->message != WM_DDE_ACK && WIN_GetFullHandle((HWND)msg->wParam) != pConv->hwndServer)
|
||||
|
@ -825,7 +827,7 @@ static WDML_QUEUE_STATE WDML_HandleTerminateReply(WDML_CONV* pConv, MSG* msg, WD
|
|||
*/
|
||||
static WDML_QUEUE_STATE WDML_HandleIncomingData(WDML_CONV* pConv, MSG* msg, HDDEDATA* hdd)
|
||||
{
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
HDDEDATA hDdeDataIn, hDdeDataOut;
|
||||
WDML_LINK* pLink;
|
||||
WINE_DDEHEAD wdh;
|
||||
|
@ -1087,7 +1089,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
|
|||
WDML_XACT* pXAct;
|
||||
HDDEDATA hDdeData = 0;
|
||||
|
||||
TRACE("(%p,%ld,%p,%p,%d,%d,%ld,%p)\n",
|
||||
TRACE("(%p,%ld,%p,%p,%x,%x,%ld,%p)\n",
|
||||
pData, cbData, hConv, hszItem, wFmt, wType, dwTimeout, pdwResult);
|
||||
|
||||
if (hConv == 0)
|
||||
|
@ -1162,7 +1164,7 @@ HDDEDATA WINAPI DdeClientTransaction(LPBYTE pData, DWORD cbData, HCONV hConv, HS
|
|||
|
||||
if (!PostMessageA(pConv->hwndServer, pXAct->ddeMsg, (WPARAM)pConv->hwndClient, pXAct->lParam))
|
||||
{
|
||||
TRACE("Failed posting message %d to %p (error=0x%lx)\n",
|
||||
WARN("Failed posting message %x to %p (error=0x%lx)\n",
|
||||
pXAct->ddeMsg, pConv->hwndServer, GetLastError());
|
||||
pConv->wStatus &= ~ST_CONNECTED;
|
||||
WDML_UnQueueTransaction(pConv, pXAct);
|
||||
|
@ -1212,7 +1214,7 @@ BOOL WINAPI DdeAbandonTransaction(DWORD idInst, HCONV hConv, DWORD idTransaction
|
|||
WDML_CONV* pConv;
|
||||
WDML_XACT* pXAct;
|
||||
|
||||
TRACE("(%08lx,%08lx,%08ld);\n", idInst, (DWORD)hConv, idTransaction);
|
||||
TRACE("(%08lx,%p,%08ld);\n", idInst, hConv, idTransaction);
|
||||
|
||||
EnterCriticalSection(&WDML_CritSect);
|
||||
if ((pInstance = WDML_GetInstance(idInst)))
|
||||
|
@ -1352,7 +1354,7 @@ BOOL WINAPI DdeDisconnect(HCONV hConv)
|
|||
DWORD count, i;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(%ld)\n", (DWORD)hConv);
|
||||
TRACE("(%p)\n", hConv);
|
||||
|
||||
if (hConv == 0)
|
||||
{
|
||||
|
@ -1402,6 +1404,8 @@ BOOL WINAPI DdeImpersonateClient(HCONV hConv)
|
|||
WDML_CONV* pConv;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
TRACE("(%p)\n", hConv);
|
||||
|
||||
EnterCriticalSection(&WDML_CritSect);
|
||||
pConv = WDML_GetConv(hConv, TRUE);
|
||||
if (pConv)
|
||||
|
|
|
@ -195,6 +195,8 @@ extern HDDEDATA WDML_InvokeCallback16(PFNCALLBACK pfn, UINT uType, UINT uFmt, H
|
|||
extern WDML_SERVER* WDML_AddServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic);
|
||||
extern void WDML_RemoveServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic);
|
||||
extern WDML_SERVER* WDML_FindServer(WDML_INSTANCE* pInstance, HSZ hszService, HSZ hszTopic);
|
||||
/* transaction handler on the server side */
|
||||
extern WDML_QUEUE_STATE WDML_ServerHandle(WDML_CONV* pConv, WDML_XACT* pXAct);
|
||||
/* called both in DdeClientTransaction and server side. */
|
||||
extern UINT WDML_Initialize(LPDWORD pidInst, PFNCALLBACK pfnCallback,
|
||||
DWORD afCmd, DWORD ulRes, BOOL bUnicode, BOOL b16);
|
||||
|
|
|
@ -64,10 +64,10 @@ CRITICAL_SECTION WDML_CritSect = CRITICAL_SECTION_INIT("WDML_CritSect");
|
|||
* RETURNS
|
||||
* the packed lParam
|
||||
*/
|
||||
LPARAM WINAPI PackDDElParam(UINT msg, UINT uiLo, UINT uiHi)
|
||||
LPARAM WINAPI PackDDElParam(UINT msg, UINT_PTR uiLo, UINT_PTR uiHi)
|
||||
{
|
||||
HGLOBAL hMem;
|
||||
UINT* params;
|
||||
UINT_PTR *params;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ LPARAM WINAPI PackDDElParam(UINT msg, UINT uiLo, UINT uiHi)
|
|||
case WM_DDE_ADVISE:
|
||||
case WM_DDE_DATA:
|
||||
case WM_DDE_POKE:
|
||||
if (!(hMem = GlobalAlloc(GMEM_DDESHARE, sizeof(UINT) * 2)))
|
||||
if (!(hMem = GlobalAlloc(GMEM_DDESHARE, sizeof(UINT_PTR) * 2)))
|
||||
{
|
||||
ERR("GlobalAlloc failed\n");
|
||||
return 0;
|
||||
|
@ -94,7 +94,7 @@ LPARAM WINAPI PackDDElParam(UINT msg, UINT uiLo, UINT uiHi)
|
|||
return uiHi;
|
||||
|
||||
default:
|
||||
return MAKELONG(uiLo, uiHi);
|
||||
return MAKELPARAM(uiLo, uiHi);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,9 +107,9 @@ LPARAM WINAPI PackDDElParam(UINT msg, UINT uiLo, UINT uiHi)
|
|||
* failure: zero
|
||||
*/
|
||||
BOOL WINAPI UnpackDDElParam(UINT msg, LPARAM lParam,
|
||||
PUINT uiLo, PUINT uiHi)
|
||||
PUINT_PTR uiLo, PUINT_PTR uiHi)
|
||||
{
|
||||
UINT *params;
|
||||
UINT_PTR *params;
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
|
@ -123,6 +123,7 @@ BOOL WINAPI UnpackDDElParam(UINT msg, LPARAM lParam,
|
|||
ERR("GlobalLock failed (%lx)\n", lParam);
|
||||
return FALSE;
|
||||
}
|
||||
TRACE("unpacked: low %08x, high %08x\n", params[0], params[1]);
|
||||
if (uiLo) *uiLo = params[0];
|
||||
if (uiHi) *uiHi = params[1];
|
||||
GlobalUnlock( (HGLOBAL)lParam );
|
||||
|
@ -173,9 +174,9 @@ BOOL WINAPI FreeDDElParam(UINT msg, LPARAM lParam)
|
|||
* the packed lParam
|
||||
*/
|
||||
LPARAM WINAPI ReuseDDElParam(LPARAM lParam, UINT msgIn, UINT msgOut,
|
||||
UINT uiLo, UINT uiHi)
|
||||
UINT_PTR uiLo, UINT_PTR uiHi)
|
||||
{
|
||||
UINT* params;
|
||||
UINT_PTR *params;
|
||||
|
||||
switch (msgIn)
|
||||
{
|
||||
|
@ -207,7 +208,7 @@ LPARAM WINAPI ReuseDDElParam(LPARAM lParam, UINT msgIn, UINT msgOut,
|
|||
|
||||
default:
|
||||
FreeDDElParam( msgIn, lParam );
|
||||
return MAKELONG(uiLo, uiHi);
|
||||
return MAKELPARAM(uiLo, uiHi);
|
||||
}
|
||||
|
||||
default:
|
||||
|
@ -623,6 +624,8 @@ BOOL WINAPI DdeUninitialize(DWORD idInst)
|
|||
WDML_CONV* pConv;
|
||||
WDML_CONV* pConvNext;
|
||||
|
||||
TRACE("(%ld)\n", idInst);
|
||||
|
||||
EnterCriticalSection(&WDML_CritSect);
|
||||
|
||||
/* First check instance
|
||||
|
@ -716,7 +719,7 @@ HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInstance, UINT uType, UINT uFmt, H
|
|||
|
||||
if (pInstance == NULL)
|
||||
return NULL;
|
||||
TRACE("invoking CB%d[%p] (%u %u %p %p %p %p %lu %lu)\n",
|
||||
TRACE("invoking CB%d[%p] (%x %x %p %p %p %p %lx %lx)\n",
|
||||
pInstance->win16 ? 16 : 32, pInstance->callback, uType, uFmt,
|
||||
hConv, hsz1, hsz2, hdata, dwData1, dwData2);
|
||||
if (pInstance->win16)
|
||||
|
@ -728,7 +731,7 @@ HDDEDATA WDML_InvokeCallback(WDML_INSTANCE* pInstance, UINT uType, UINT uFmt, H
|
|||
{
|
||||
ret = pInstance->callback(uType, uFmt, hConv, hsz1, hsz2, hdata, dwData1, dwData2);
|
||||
}
|
||||
TRACE("done => %08lx\n", (DWORD)ret);
|
||||
TRACE("done => %p\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1022,7 +1025,7 @@ DWORD WINAPI DdeQueryStringA(DWORD idInst, HSZ hsz, LPSTR psz, DWORD cchMax, INT
|
|||
}
|
||||
LeaveCriticalSection(&WDML_CritSect);
|
||||
|
||||
TRACE("returning %s\n", debugstr_a(psz));
|
||||
TRACE("returning %ld (%s)\n", ret, debugstr_a(psz));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1049,7 +1052,7 @@ DWORD WINAPI DdeQueryStringW(DWORD idInst, HSZ hsz, LPWSTR psz, DWORD cchMax, IN
|
|||
}
|
||||
LeaveCriticalSection(&WDML_CritSect);
|
||||
|
||||
TRACE("returning %s\n", debugstr_w(psz));
|
||||
TRACE("returning %ld (%s)\n", ret, debugstr_w(psz));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1092,7 +1095,7 @@ HSZ WINAPI DdeCreateStringHandleA(DWORD idInst, LPCSTR psz, INT codepage)
|
|||
HSZ hsz = 0;
|
||||
WDML_INSTANCE* pInstance;
|
||||
|
||||
TRACE("(%ld,%p,%d)\n", idInst, psz, codepage);
|
||||
TRACE("(%ld,%s,%d)\n", idInst, debugstr_a(psz), codepage);
|
||||
|
||||
EnterCriticalSection(&WDML_CritSect);
|
||||
|
||||
|
@ -1124,7 +1127,7 @@ HSZ WINAPI DdeCreateStringHandleW(DWORD idInst, LPCWSTR psz, INT codepage)
|
|||
WDML_INSTANCE* pInstance;
|
||||
HSZ hsz = 0;
|
||||
|
||||
TRACE("(%ld,%p,%d)\n", idInst, psz, codepage);
|
||||
TRACE("(%ld,%s,%d)\n", idInst, debugstr_w(psz), codepage);
|
||||
|
||||
EnterCriticalSection(&WDML_CritSect);
|
||||
|
||||
|
@ -1269,15 +1272,18 @@ HDDEDATA WINAPI DdeCreateDataHandle(DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD c
|
|||
HGLOBAL hMem;
|
||||
LPBYTE pByte;
|
||||
DDE_DATAHANDLE_HEAD* pDdh;
|
||||
WCHAR psz[MAX_BUFFER_LEN];
|
||||
|
||||
TRACE("(%ld,%p,%ld,%ld,0x%lx,%d,%d)\n",
|
||||
idInst, pSrc, cb, cbOff, (DWORD)hszItem, wFmt, afCmd);
|
||||
GetAtomNameW(HSZ2ATOM(hszItem), psz, MAX_BUFFER_LEN);
|
||||
|
||||
TRACE("(%ld,%p,cb %ld, cbOff %ld,%p <%s>,%x,%x)\n",
|
||||
idInst, pSrc, cb, cbOff, hszItem, debugstr_w(psz), wFmt, afCmd);
|
||||
|
||||
if (afCmd != 0 && afCmd != HDATA_APPOWNED)
|
||||
return 0;
|
||||
|
||||
/* we use the first 4 bytes to store the size */
|
||||
if (!(hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, cb + sizeof(DDE_DATAHANDLE_HEAD))))
|
||||
if (!(hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, cb + cbOff + sizeof(DDE_DATAHANDLE_HEAD))))
|
||||
{
|
||||
ERR("GlobalAlloc failed\n");
|
||||
return 0;
|
||||
|
@ -1312,6 +1318,8 @@ HDDEDATA WINAPI DdeAddData(HDDEDATA hData, LPBYTE pSrc, DWORD cb, DWORD cbOff)
|
|||
DWORD old_sz, new_sz;
|
||||
LPBYTE pDst;
|
||||
|
||||
TRACE("(%p,%p,cb %ld, cbOff %ld)\n", hData, pSrc, cb, cbOff);
|
||||
|
||||
pDst = DdeAccessData(hData, &old_sz);
|
||||
if (!pDst) return 0;
|
||||
|
||||
|
@ -1349,7 +1357,7 @@ DWORD WINAPI DdeGetData(HDDEDATA hData, LPBYTE pDst, DWORD cbMax, DWORD cbOff)
|
|||
DWORD dwSize, dwRet;
|
||||
LPBYTE pByte;
|
||||
|
||||
TRACE("(%08lx,%p,%ld,%ld)\n",(DWORD)hData, pDst, cbMax, cbOff);
|
||||
TRACE("(%p,%p,%ld,%ld)\n", hData, pDst, cbMax, cbOff);
|
||||
|
||||
pByte = DdeAccessData(hData, &dwSize);
|
||||
|
||||
|
@ -1392,7 +1400,7 @@ LPBYTE WINAPI DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize)
|
|||
HGLOBAL hMem = (HGLOBAL)hData;
|
||||
DDE_DATAHANDLE_HEAD* pDdh;
|
||||
|
||||
TRACE("(%08lx,%p)\n", (DWORD)hData, pcbDataSize);
|
||||
TRACE("(%p,%p)\n", hData, pcbDataSize);
|
||||
|
||||
pDdh = (DDE_DATAHANDLE_HEAD*)GlobalLock(hMem);
|
||||
if (pDdh == NULL)
|
||||
|
@ -1405,7 +1413,7 @@ LPBYTE WINAPI DdeAccessData(HDDEDATA hData, LPDWORD pcbDataSize)
|
|||
{
|
||||
*pcbDataSize = GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD);
|
||||
}
|
||||
TRACE("=> %08lx (%lu)\n", (DWORD)(pDdh + 1), GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD));
|
||||
TRACE("=> %p (%lu)\n", pDdh + 1, GlobalSize(hMem) - sizeof(DDE_DATAHANDLE_HEAD));
|
||||
return (LPBYTE)(pDdh + 1);
|
||||
}
|
||||
|
||||
|
@ -1416,7 +1424,7 @@ BOOL WINAPI DdeUnaccessData(HDDEDATA hData)
|
|||
{
|
||||
HGLOBAL hMem = (HGLOBAL)hData;
|
||||
|
||||
TRACE("(0x%lx)\n", (DWORD)hData);
|
||||
TRACE("(%p)\n", hData);
|
||||
|
||||
GlobalUnlock(hMem);
|
||||
|
||||
|
@ -1428,6 +1436,7 @@ BOOL WINAPI DdeUnaccessData(HDDEDATA hData)
|
|||
*/
|
||||
BOOL WINAPI DdeFreeDataHandle(HDDEDATA hData)
|
||||
{
|
||||
TRACE("(%p)\n", hData);
|
||||
return GlobalFree((HGLOBAL)hData) == 0;
|
||||
}
|
||||
|
||||
|
@ -1571,6 +1580,7 @@ HGLOBAL WDML_DataHandle2Global(HDDEDATA hDdeData, BOOL fResponse, BOOL fRelease,
|
|||
}
|
||||
if (wdh)
|
||||
{
|
||||
wdh->unused = 0;
|
||||
wdh->fResponse = fResponse;
|
||||
wdh->fRelease = fRelease;
|
||||
wdh->fDeferUpd = fDeferUpd;
|
||||
|
@ -1821,14 +1831,65 @@ void WDML_RemoveConv(WDML_CONV* pRef, WDML_SIDE side)
|
|||
}
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
* WDML_EnableCallback
|
||||
*/
|
||||
static BOOL WDML_EnableCallback(WDML_CONV *pConv, UINT wCmd)
|
||||
{
|
||||
if (wCmd == EC_DISABLE)
|
||||
{
|
||||
FIXME("EC_DISABLE is not implemented\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (wCmd == EC_QUERYWAITING)
|
||||
return pConv->transactions ? TRUE : FALSE;
|
||||
|
||||
if (wCmd != EC_ENABLEALL && wCmd != EC_ENABLEONE)
|
||||
{
|
||||
FIXME("Unknown command code %04x\n", wCmd);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while (pConv->transactions)
|
||||
{
|
||||
WDML_XACT *pXAct = pConv->transactions;
|
||||
WDML_UnQueueTransaction(pConv, pXAct);
|
||||
|
||||
if (pConv->wStatus & ST_CLIENT)
|
||||
{
|
||||
/*WDML_ClientHandle(pConv, pXAct);*/
|
||||
FIXME("Client delayed transaction queue handling is not supported\n");
|
||||
}
|
||||
else
|
||||
WDML_ServerHandle(pConv, pXAct);
|
||||
|
||||
WDML_FreeTransaction(pConv->instance, pXAct, TRUE);
|
||||
|
||||
if (wCmd == EC_ENABLEONE) break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
* DdeEnableCallback (USER32.@)
|
||||
*/
|
||||
BOOL WINAPI DdeEnableCallback(DWORD idInst, HCONV hConv, UINT wCmd)
|
||||
{
|
||||
FIXME("(%ld, %p, %d) stub\n", idInst, hConv, wCmd);
|
||||
BOOL ret = FALSE;
|
||||
WDML_CONV *pConv;
|
||||
|
||||
return 0;
|
||||
TRACE("(%ld, %p, %04x)\n", idInst, hConv, wCmd);
|
||||
|
||||
EnterCriticalSection(&WDML_CritSect);
|
||||
|
||||
pConv = WDML_GetConv(hConv, TRUE);
|
||||
|
||||
if (pConv && pConv->instance->instanceID == idInst)
|
||||
ret = WDML_EnableCallback(pConv, wCmd);
|
||||
|
||||
LeaveCriticalSection(&WDML_CritSect);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
@ -1914,6 +1975,8 @@ BOOL WINAPI DdeSetUserHandle(HCONV hConv, DWORD id, DWORD hUser)
|
|||
WDML_CONV* pConv;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
TRACE("(%p,%lx,%lx)\n", hConv, id, hUser);
|
||||
|
||||
EnterCriticalSection(&WDML_CritSect);
|
||||
|
||||
pConv = WDML_GetConv(hConv, FALSE);
|
||||
|
@ -2033,6 +2096,7 @@ UINT WINAPI DdeQueryConvInfo(HCONV hConv, DWORD id, PCONVINFO lpConvInfo)
|
|||
CONVINFO ci;
|
||||
WDML_CONV* pConv;
|
||||
|
||||
TRACE("(%p,%lx,%p)\n", hConv, id, lpConvInfo);
|
||||
|
||||
if (!hConv)
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem)
|
|||
if (DdeCmpStringHandles(hszItem, pLink->hszItem) == 0)
|
||||
{
|
||||
hDdeData = WDML_InvokeCallback(pInstance, XTYP_ADVREQ, pLink->uFmt, pLink->hConv,
|
||||
hszTopic, hszItem, 0, count--, 0);
|
||||
hszTopic, hszItem, 0, 0, 0);
|
||||
|
||||
if (hDdeData == (HDDEDATA)CBR_BLOCK)
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ BOOL WINAPI DdePostAdvise(DWORD idInst, HSZ hszTopic, HSZ hszItem)
|
|||
}
|
||||
|
||||
if (!PostMessageA(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
|
||||
PackDDElParam(WM_DDE_DATA, (UINT)hItemData, atom)))
|
||||
PackDDElParam(WM_DDE_DATA, (UINT_PTR)hItemData, atom)))
|
||||
{
|
||||
ERR("post message failed\n");
|
||||
pConv->wStatus &= ~ST_CONNECTED;
|
||||
|
@ -176,7 +176,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
|
|||
|
||||
hDdeData = NULL;
|
||||
|
||||
TRACE("(%ld,%p,%p,%d)\n", idInst, hsz1, hsz2, afCmd);
|
||||
TRACE("(%ld,%p,%p,%x)\n", idInst, hsz1, hsz2, afCmd);
|
||||
|
||||
EnterCriticalSection(&WDML_CritSect);
|
||||
|
||||
|
@ -198,7 +198,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
|
|||
WARN("Reserved parameter no-zero !!\n");
|
||||
goto theError;
|
||||
}
|
||||
if (hsz1 == 0 && afCmd != DNS_UNREGISTER)
|
||||
if (hsz1 == 0 && !(afCmd & DNS_UNREGISTER))
|
||||
{
|
||||
/* don't know if we should check this but it makes sense
|
||||
* why supply REGISTER or filter flags if de-registering all
|
||||
|
@ -208,7 +208,7 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
|
|||
goto theError;
|
||||
}
|
||||
|
||||
switch (afCmd)
|
||||
switch (afCmd & (DNS_REGISTER | DNS_UNREGISTER))
|
||||
{
|
||||
case DNS_REGISTER:
|
||||
pServer = WDML_FindServer(pInstance, hsz1, 0);
|
||||
|
@ -272,8 +272,10 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
|
|||
WDML_RemoveServer(pInstance, hsz1, 0L);
|
||||
}
|
||||
break;
|
||||
case DNS_FILTERON:
|
||||
case DNS_FILTEROFF:
|
||||
}
|
||||
|
||||
if (afCmd & (DNS_FILTERON | DNS_FILTEROFF))
|
||||
{
|
||||
/* Set filter flags on to hold notifications of connection
|
||||
*/
|
||||
pServer = WDML_FindServer(pInstance, hsz1, 0);
|
||||
|
@ -286,9 +288,8 @@ HDDEDATA WINAPI DdeNameService(DWORD idInst, HSZ hsz1, HSZ hsz2, UINT afCmd)
|
|||
}
|
||||
else
|
||||
{
|
||||
pServer->filterOn = (afCmd == DNS_FILTERON);
|
||||
pServer->filterOn = (afCmd & DNS_FILTERON) != 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
LeaveCriticalSection(&WDML_CritSect);
|
||||
return (HDDEDATA)TRUE;
|
||||
|
@ -394,7 +395,7 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
|
|||
HSZ hszApp, hszTop;
|
||||
HDDEDATA hDdeData = 0;
|
||||
WDML_INSTANCE* pInstance;
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
|
||||
switch (iMsg)
|
||||
{
|
||||
|
@ -461,7 +462,12 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
|
|||
{
|
||||
pConv = WDML_CreateServerConv(pInstance, hwndClient, hwndServer,
|
||||
hszApp, hszTop);
|
||||
if (pConv && pcc) pConv->wStatus |= ST_ISLOCAL;
|
||||
if (pConv)
|
||||
{
|
||||
if (pcc) pConv->wStatus |= ST_ISLOCAL;
|
||||
WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv,
|
||||
hszTop, hszApp, 0, (DWORD)pcc, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +494,12 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
|
|||
{
|
||||
pConv = WDML_CreateServerConv(pInstance, hwndClient, hwndServer,
|
||||
hszp[i].hszSvc, hszp[i].hszTopic);
|
||||
if (pConv && pcc) pConv->wStatus |= ST_ISLOCAL;
|
||||
if (pConv)
|
||||
{
|
||||
if (pcc) pConv->wStatus |= ST_ISLOCAL;
|
||||
WDML_InvokeCallback(pInstance, XTYP_CONNECT_CONFIRM, 0, (HCONV)pConv,
|
||||
hszp[i].hszTopic, hszp[i].hszSvc, 0, (DWORD)pcc, self);
|
||||
}
|
||||
}
|
||||
DdeUnaccessData(hDdeData);
|
||||
}
|
||||
|
@ -531,7 +542,7 @@ static LRESULT CALLBACK WDML_ServerNameProc(HWND hwndServer, UINT iMsg, WPARAM w
|
|||
*/
|
||||
static WDML_XACT* WDML_ServerQueueRequest(WDML_CONV* pConv, LPARAM lParam)
|
||||
{
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
WDML_XACT* pXAct;
|
||||
|
||||
UnpackDDElParam(WM_DDE_REQUEST, lParam, &uiLo, &uiHi);
|
||||
|
@ -559,7 +570,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX
|
|||
pConv->hszTopic, pXAct->hszItem, 0, 0, 0);
|
||||
}
|
||||
|
||||
switch ((DWORD)hDdeData)
|
||||
switch ((ULONG_PTR)hDdeData)
|
||||
{
|
||||
case 0:
|
||||
WDML_PostAck(pConv, WDML_SERVER_SIDE, 0, FALSE, FALSE, pXAct->atom,
|
||||
|
@ -570,7 +581,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX
|
|||
break;
|
||||
default:
|
||||
{
|
||||
HGLOBAL hMem = WDML_DataHandle2Global(hDdeData, FALSE, FALSE, FALSE, FALSE);
|
||||
HGLOBAL hMem = WDML_DataHandle2Global(hDdeData, TRUE, TRUE, FALSE, FALSE);
|
||||
if (!PostMessageA(pConv->hwndClient, WM_DDE_DATA, (WPARAM)pConv->hwndServer,
|
||||
ReuseDDElParam(pXAct->lParam, WM_DDE_REQUEST, WM_DDE_DATA,
|
||||
(UINT)hMem, (UINT)pXAct->atom)))
|
||||
|
@ -592,7 +603,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleRequest(WDML_CONV* pConv, WDML_XACT* pX
|
|||
*/
|
||||
static WDML_XACT* WDML_ServerQueueAdvise(WDML_CONV* pConv, LPARAM lParam)
|
||||
{
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
WDML_XACT* pXAct;
|
||||
|
||||
/* XTYP_ADVSTART transaction:
|
||||
|
@ -654,7 +665,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA
|
|||
}
|
||||
else
|
||||
{
|
||||
TRACE("Adding Link with hConv=0x%lx\n", (DWORD)pConv);
|
||||
TRACE("Adding Link with hConv %p\n", pConv);
|
||||
WDML_AddLink(pConv->instance, (HCONV)pConv, WDML_SERVER_SIDE,
|
||||
uType, pXAct->hszItem, pDdeAdvise->cfFormat);
|
||||
}
|
||||
|
@ -686,7 +697,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleAdvise(WDML_CONV* pConv, WDML_XACT* pXA
|
|||
*/
|
||||
static WDML_XACT* WDML_ServerQueueUnadvise(WDML_CONV* pConv, LPARAM lParam)
|
||||
{
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
WDML_XACT* pXAct;
|
||||
|
||||
UnpackDDElParam(WM_DDE_UNADVISE, lParam, &uiLo, &uiHi);
|
||||
|
@ -716,7 +727,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleUnadvise(WDML_CONV* pConv, WDML_XACT* p
|
|||
pXAct->hszItem, TRUE, pXAct->wFmt);
|
||||
if (pLink == NULL)
|
||||
{
|
||||
ERR("Couln'd find link for %08lx, dropping request\n", (DWORD)pXAct->hszItem);
|
||||
ERR("Couln'd find link for %p, dropping request\n", pXAct->hszItem);
|
||||
FreeDDElParam(WM_DDE_UNADVISE, pXAct->lParam);
|
||||
return WDML_QS_ERROR;
|
||||
}
|
||||
|
@ -806,7 +817,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleExecute(WDML_CONV* pConv, WDML_XACT* pX
|
|||
*/
|
||||
static WDML_XACT* WDML_ServerQueuePoke(WDML_CONV* pConv, LPARAM lParam)
|
||||
{
|
||||
UINT uiLo, uiHi;
|
||||
UINT_PTR uiLo, uiHi;
|
||||
WDML_XACT* pXAct;
|
||||
|
||||
UnpackDDElParam(WM_DDE_POKE, lParam, &uiLo, &uiHi);
|
||||
|
@ -850,7 +861,7 @@ static WDML_QUEUE_STATE WDML_ServerHandlePoke(WDML_CONV* pConv, WDML_XACT* pXAct
|
|||
hDdeDataOut = WDML_InvokeCallback(pConv->instance, XTYP_POKE, pDdePoke->cfFormat,
|
||||
(HCONV)pConv, pConv->hszTopic, pXAct->hszItem,
|
||||
hDdeData, 0, 0);
|
||||
switch ((UINT)hDdeDataOut)
|
||||
switch ((ULONG_PTR)hDdeDataOut)
|
||||
{
|
||||
case DDE_FACK:
|
||||
fAck = TRUE;
|
||||
|
@ -859,7 +870,7 @@ static WDML_QUEUE_STATE WDML_ServerHandlePoke(WDML_CONV* pConv, WDML_XACT* pXAct
|
|||
fBusy = TRUE;
|
||||
break;
|
||||
default:
|
||||
FIXME("Unsupported returned value %08lx\n", (DWORD)hDdeDataOut);
|
||||
FIXME("Unsupported returned value %p\n", hDdeDataOut);
|
||||
/* fal through */
|
||||
case DDE_FNOTPROCESSED:
|
||||
break;
|
||||
|
@ -919,7 +930,7 @@ static WDML_QUEUE_STATE WDML_ServerHandleTerminate(WDML_CONV* pConv, WDML_XACT*
|
|||
*
|
||||
*
|
||||
*/
|
||||
static WDML_QUEUE_STATE WDML_ServerHandle(WDML_CONV* pConv, WDML_XACT* pXAct)
|
||||
WDML_QUEUE_STATE WDML_ServerHandle(WDML_CONV* pConv, WDML_XACT* pXAct)
|
||||
{
|
||||
WDML_QUEUE_STATE qs = WDML_QS_ERROR;
|
||||
|
||||
|
@ -995,7 +1006,7 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
|
|||
|
||||
if (!pConv)
|
||||
{
|
||||
ERR("Got a message (%u) 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;
|
||||
}
|
||||
if (pConv->hwndClient != WIN_GetFullHandle( (HWND)wParam ) || pConv->hwndServer != hwndServer)
|
||||
|
@ -1044,7 +1055,7 @@ static LRESULT CALLBACK WDML_ServerConvProc(HWND hwndServer, UINT iMsg, WPARAM w
|
|||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unsupported message %d\n", iMsg);
|
||||
FIXME("Unsupported message %x\n", iMsg);
|
||||
}
|
||||
|
||||
if (pXAct)
|
||||
|
|
|
@ -1170,7 +1170,7 @@ static HGLOBAL dde_get_pair(HGLOBAL shm)
|
|||
/***********************************************************************
|
||||
* post_dde_message
|
||||
*
|
||||
* Post a DDE messag
|
||||
* Post a DDE message
|
||||
*/
|
||||
static BOOL post_dde_message( DWORD dest_tid, struct packed_message *data, const struct send_message_info *info )
|
||||
{
|
||||
|
@ -1234,6 +1234,10 @@ static BOOL post_dde_message( DWORD dest_tid, struct packed_message *data, const
|
|||
{
|
||||
if ((ptr = GlobalLock( (HGLOBAL)uiLo) ))
|
||||
{
|
||||
DDEDATA *dde_data = (DDEDATA *)ptr;
|
||||
TRACE("unused %d, fResponse %d, fRelease %d, fDeferUpd %d, fAckReq %d, cfFormat %d\n",
|
||||
dde_data->unused, dde_data->fResponse, dde_data->fRelease,
|
||||
dde_data->reserved, dde_data->fAckReq, dde_data->cfFormat);
|
||||
push_data( data, ptr, size );
|
||||
hunlock = (HGLOBAL)uiLo;
|
||||
}
|
||||
|
@ -1305,7 +1309,7 @@ static BOOL unpack_dde_message( HWND hwnd, UINT message, WPARAM *wparam, LPARAM
|
|||
uiLo = *lparam;
|
||||
memcpy( &hMem, *buffer, size );
|
||||
uiHi = (UINT)hMem;
|
||||
TRACE("recv dde-ack %u mem=%x[%lx]\n", uiLo, uiHi, GlobalSize( hMem ));
|
||||
TRACE("recv dde-ack %x mem=%x[%lx]\n", uiLo, uiHi, GlobalSize( hMem ));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1500,8 +1504,9 @@ BOOL MSG_peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, int flags )
|
|||
|
||||
if (res) return FALSE;
|
||||
|
||||
TRACE( "got type %d msg %x hwnd %p wp %x lp %lx\n",
|
||||
info.type, info.msg.message, info.msg.hwnd, info.msg.wParam, info.msg.lParam );
|
||||
TRACE( "got type %d msg %x (%s) hwnd %p wp %x lp %lx\n",
|
||||
info.type, info.msg.message, SPY_GetMsgName(info.msg.message, info.msg.hwnd),
|
||||
info.msg.hwnd, info.msg.wParam, info.msg.lParam );
|
||||
|
||||
switch(info.type)
|
||||
{
|
||||
|
@ -2044,6 +2049,9 @@ BOOL WINAPI PostMessageW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
TRACE( "hwnd %p msg %x (%s) wp %x lp %lx\n",
|
||||
hwnd, msg, SPY_GetMsgName(msg, hwnd), wparam, lparam );
|
||||
|
||||
info.type = MSG_POSTED;
|
||||
info.hwnd = hwnd;
|
||||
info.msg = msg;
|
||||
|
|
|
@ -41,36 +41,33 @@ extern "C" {
|
|||
#define WM_DDE_FIRST WM_DDE_INITIATE
|
||||
|
||||
/* DDEACK: wStatus in WM_DDE_ACK message */
|
||||
struct tagDDEACK
|
||||
typedef struct
|
||||
{
|
||||
unsigned short bAppReturnCode:8, reserved:6, fBusy:1, fAck:1;
|
||||
};
|
||||
typedef struct tagDDEACK DDEACK;
|
||||
} DDEACK;
|
||||
|
||||
/* DDEDATA: hData in WM_DDE_DATA message */
|
||||
struct tagDDEDATA
|
||||
typedef struct
|
||||
{
|
||||
unsigned unused:12, fResponse:1, fRelease:1, reserved:1, fAckReq:1,
|
||||
cfFormat:16;
|
||||
unsigned short unused:12, fResponse:1, fRelease:1, reserved:1, fAckReq:1;
|
||||
short cfFormat;
|
||||
BYTE Value[1]; /* undetermined array */
|
||||
};
|
||||
typedef struct tagDDEDATA DDEDATA;
|
||||
|
||||
} DDEDATA;
|
||||
|
||||
/* DDEADVISE: hOptions in WM_DDE_ADVISE message */
|
||||
struct tagDDEADVISE
|
||||
typedef struct
|
||||
{
|
||||
unsigned reserved:14, fDeferUpd:1, fAckReq:1, cfFormat:16;
|
||||
};
|
||||
typedef struct tagDDEADVISE DDEADVISE;
|
||||
unsigned short reserved:14, fDeferUpd:1, fAckReq:1;
|
||||
short cfFormat;
|
||||
} DDEADVISE;
|
||||
|
||||
/* DDEPOKE: hData in WM_DDE_POKE message. */
|
||||
struct tagDDEPOKE
|
||||
typedef struct
|
||||
{
|
||||
unsigned unused:13, fRelease:1, fReserved:2, cfFormat:16;
|
||||
unsigned short unused:13, fRelease:1, fReserved:2;
|
||||
short cfFormat;
|
||||
BYTE Value[1]; /* undetermined array */
|
||||
};
|
||||
typedef struct tagDDEPOKE DDEPOKE;
|
||||
} DDEPOKE;
|
||||
|
||||
BOOL WINAPI DdeSetQualityOfService(HWND hwndClient,
|
||||
CONST SECURITY_QUALITY_OF_SERVICE *pqosNew,
|
||||
|
@ -80,10 +77,10 @@ BOOL WINAPI ImpersonateDdeClientWindow(HWND hWndClient, HWND hWndServer);
|
|||
|
||||
/* lParam packing/unpacking API */
|
||||
|
||||
LPARAM WINAPI PackDDElParam(UINT,UINT,UINT);
|
||||
BOOL WINAPI UnpackDDElParam(UINT,LPARAM,PUINT,PUINT);
|
||||
LPARAM WINAPI PackDDElParam(UINT,UINT_PTR,UINT_PTR);
|
||||
BOOL WINAPI UnpackDDElParam(UINT,LPARAM,PUINT_PTR,PUINT_PTR);
|
||||
BOOL WINAPI FreeDDElParam(UINT,LPARAM);
|
||||
LPARAM WINAPI ReuseDDElParam(LPARAM,UINT,UINT,UINT,UINT);
|
||||
LPARAM WINAPI ReuseDDElParam(LPARAM,UINT,UINT,UINT_PTR,UINT_PTR);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -89,6 +89,15 @@ extern "C" {
|
|||
#define ST_BLOCKNEXT 0x0080
|
||||
#define ST_ISSELF 0x0100
|
||||
|
||||
/*
|
||||
* DdeEnableCallback function codes
|
||||
*/
|
||||
|
||||
#define EC_ENABLEALL 0
|
||||
#define EC_ENABLEONE ST_BLOCKNEXT
|
||||
#define EC_DISABLE ST_BLOCKED
|
||||
#define EC_QUERYWAITING 2
|
||||
|
||||
/*
|
||||
* Callback filter flags for use with standard apps.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue