user32: Convert an HDDEDATA handle to a DDEPOKE structure for WM_DDE_POKE.

This commit is contained in:
James Hawkins 2007-10-12 00:25:32 -05:00 committed by Alexandre Julliard
parent 88913f094b
commit 9fd2d443fe
2 changed files with 27 additions and 23 deletions

View File

@ -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;

View File

@ -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"),