Module: wine Branch: master Commit: 9fd2d443fe8ea55d58756f1ff927996810b709ae URL: http://source.winehq.org/git/wine.git/?a=commit;h=9fd2d443fe8ea55d58756f1ff9...
Author: James Hawkins truiken@gmail.com Date: Fri Oct 12 00:25:32 2007 -0500
user32: Convert an HDDEDATA handle to a DDEPOKE structure for WM_DDE_POKE.
---
dlls/user32/dde_client.c | 41 ++++++++++++++++++++++++----------------- dlls/user32/tests/dde.c | 9 +++------ 2 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/dlls/user32/dde_client.c b/dlls/user32/dde_client.c index fe2dada..3e22768 100644 --- a/dlls/user32/dde_client.c +++ b/dlls/user32/dde_client.c @@ -697,8 +697,11 @@ static WDML_QUEUE_STATE WDML_HandleExecuteReply(WDML_CONV* pConv, MSG* msg, WDML static WDML_XACT* WDML_ClientQueuePoke(WDML_CONV* pConv, LPVOID pData, DWORD cbData, UINT wFmt, HSZ hszItem) { - WDML_XACT* pXAct; - ATOM atom; + DDE_DATAHANDLE_HEAD *dh; + WDML_XACT *pXAct; + DDEPOKE *ddePoke; + HGLOBAL hglobal; + ATOM atom;
TRACE("XTYP_POKE transaction\n");
@@ -708,29 +711,33 @@ static WDML_XACT* WDML_ClientQueuePoke(WDML_CONV* pConv, LPVOID pData, DWORD cbD pXAct = WDML_AllocTransaction(pConv->instance, WM_DDE_POKE, wFmt, hszItem); if (!pXAct) { - GlobalDeleteAtom(atom); - return NULL; + GlobalDeleteAtom(atom); + return NULL; }
if (cbData == (DWORD)-1) { - pXAct->hMem = (HDDEDATA)pData; + hglobal = (HGLOBAL)pData; + dh = (DDE_DATAHANDLE_HEAD *)GlobalLock(hglobal); + cbData = GlobalSize(hglobal) - sizeof(DDE_DATAHANDLE_HEAD); + pData = (LPVOID)(dh + 1); + GlobalUnlock(hglobal); } - else - { - DDEPOKE* ddePoke;
- pXAct->hMem = GlobalAlloc(GHND | GMEM_DDESHARE, sizeof(DDEPOKE) + cbData); - ddePoke = GlobalLock(pXAct->hMem); - if (ddePoke) - { - memcpy(ddePoke->Value, pData, cbData); - ddePoke->fRelease = TRUE; - ddePoke->cfFormat = wFmt; - GlobalUnlock(pXAct->hMem); - } + pXAct->hMem = GlobalAlloc(GHND | GMEM_DDESHARE, sizeof(DDEPOKE) + cbData); + ddePoke = GlobalLock(pXAct->hMem); + if (!ddePoke) + { + pConv->instance->lastError = DMLERR_MEMORY_ERROR; + return NULL; }
+ ddePoke->unused = 0; + ddePoke->fRelease = TRUE; + ddePoke->cfFormat = wFmt; + memcpy(ddePoke->Value, pData, cbData); + GlobalUnlock(pXAct->hMem); + pXAct->lParam = PackDDElParam(WM_DDE_POKE, (UINT_PTR)pXAct->hMem, atom);
return pXAct; diff --git a/dlls/user32/tests/dde.c b/dlls/user32/tests/dde.c index 1388c34..4f4e09c 100644 --- a/dlls/user32/tests/dde.c +++ b/dlls/user32/tests/dde.c @@ -171,12 +171,9 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA poke = GlobalLock((HGLOBAL)lo); ok(poke != NULL, "Expected non-NULL poke\n"); ok(poke->fReserved == 0, "Expected 0, got %d\n", poke->fReserved); - if (msg_index == 6) todo_wine - { - ok(poke->unused == 0, "Expected 0, got %d\n", poke->unused); - ok(poke->fRelease == TRUE, "Expected TRUE, got %d\n", poke->fRelease); - ok(poke->cfFormat == CF_TEXT, "Expected CF_TEXT, got %d\n", poke->cfFormat); - } + ok(poke->unused == 0, "Expected 0, got %d\n", poke->unused); + ok(poke->fRelease == TRUE, "Expected TRUE, got %d\n", poke->fRelease); + ok(poke->cfFormat == CF_TEXT, "Expected CF_TEXT, got %d\n", poke->cfFormat);
if (msg_index == 5) ok(lstrcmpA((LPSTR)poke->Value, "poke data\r\n"),