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 e421624..0862bd1 100644 --- a/dlls/user32/tests/dde.c +++ b/dlls/user32/tests/dde.c @@ -169,12 +169,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"), -- 1.4.4.2