Commit 64acbb55 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

user32: sizeof DDEPOKE and DDEDATA is six, which is probably not what is…

user32: sizeof DDEPOKE and DDEDATA is six, which is probably not what is expected, so use offsetof instead.
parent 5d929b13
......@@ -724,7 +724,7 @@ static WDML_XACT* WDML_ClientQueuePoke(WDML_CONV* pConv, LPVOID pData, DWORD cbD
GlobalUnlock(hglobal);
}
pXAct->hMem = GlobalAlloc(GHND | GMEM_DDESHARE, sizeof(DDEPOKE) + cbData);
pXAct->hMem = GlobalAlloc(GHND | GMEM_DDESHARE, FIELD_OFFSET(DDEPOKE, Value[cbData]));
ddePoke = GlobalLock(pXAct->hMem);
if (!ddePoke)
{
......
......@@ -844,7 +844,7 @@ static WDML_QUEUE_STATE WDML_ServerHandlePoke(WDML_CONV* pConv, WDML_XACT* pXAct
if (!(pConv->instance->CBFflags & CBF_FAIL_POKES))
{
hDdeData = DdeCreateDataHandle(pConv->instance->instanceID, pDdePoke->Value,
GlobalSize(pXAct->hMem) - sizeof(DDEPOKE) + 1,
GlobalSize(pXAct->hMem) - FIELD_OFFSET(DDEPOKE, Value),
0, 0, pDdePoke->cfFormat, 0);
if (hDdeData)
{
......
......@@ -1456,8 +1456,8 @@ static BOOL post_dde_message( struct packed_message *data, const struct send_mes
{
size = GlobalSize( (HGLOBAL)uiLo ) ;
if ((info->msg == WM_DDE_ADVISE && size < sizeof(DDEADVISE)) ||
(info->msg == WM_DDE_DATA && size < sizeof(DDEDATA)) ||
(info->msg == WM_DDE_POKE && size < sizeof(DDEPOKE))
(info->msg == WM_DDE_DATA && size < FIELD_OFFSET(DDEDATA, Value)) ||
(info->msg == WM_DDE_POKE && size < FIELD_OFFSET(DDEPOKE, Value))
)
return FALSE;
}
......
......@@ -699,10 +699,7 @@ static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hcon
ptr = (LPSTR)DdeAccessData(hdata, &size);
ok(!lstrcmpA(ptr, "poke data\r\n"), "Expected 'poke data\\r\\n', got %s\n", ptr);
todo_wine
{
ok(size == 14, "Expected 14, got %d\n", size);
}
ok(size == 12, "Expected 12, got %d\n", size);
DdeUnaccessData(hdata);
size = DdeQueryStringA(server_pid, hsz2, str, MAX_PATH, CP_WINANSI);
......@@ -981,7 +978,7 @@ static HGLOBAL create_poke()
DDEPOKE *poke;
DWORD size;
size = sizeof(DDEPOKE) + lstrlenA("poke data\r\n") + 1;
size = FIELD_OFFSET(DDEPOKE, Value[sizeof("poke data\r\n")]);
hglobal = GlobalAlloc(GMEM_DDESHARE, size);
ok(hglobal != 0, "Expected non-NULL hglobal\n");
......
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