comctl32/listbox: Use ULONG_PTR instead of DWORD when retrieving text without HAS_STRINGS.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2018-11-14 12:00:16 +02:00 committed by Alexandre Julliard
parent fe8ed8af8d
commit ac174f4cf4
2 changed files with 4 additions and 5 deletions

View File

@ -762,8 +762,8 @@ static LRESULT LISTBOX_GetText( LB_DESCR *descr, INT index, LPWSTR buffer, BOOL
} else } else
{ {
if (buffer) if (buffer)
*((DWORD *)buffer) = *(DWORD *)&descr->items[index].data; *((ULONG_PTR *)buffer) = descr->items[index].data;
len = sizeof(DWORD); len = sizeof(ULONG_PTR);
} }
return len; return len;
} }
@ -2653,7 +2653,7 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam,
SetLastError(ERROR_INVALID_INDEX); SetLastError(ERROR_INVALID_INDEX);
return LB_ERR; return LB_ERR;
} }
if (!HAS_STRINGS(descr)) return sizeof(DWORD); if (!HAS_STRINGS(descr)) return sizeof(ULONG_PTR);
return strlenW( descr->items[wParam].str ); return strlenW( descr->items[wParam].str );
case LB_GETCURSEL: case LB_GETCURSEL:

View File

@ -2296,12 +2296,11 @@ static void test_LBS_NODATA(void)
ret = SendMessageA(listbox, LB_SETITEMDATA, valid_idx[i], 42); ret = SendMessageA(listbox, LB_SETITEMDATA, valid_idx[i], 42);
ok(ret == TRUE, "Unexpected return value %d.\n", ret); ok(ret == TRUE, "Unexpected return value %d.\n", ret);
ret = SendMessageA(listbox, LB_GETTEXTLEN, valid_idx[i], 0); ret = SendMessageA(listbox, LB_GETTEXTLEN, valid_idx[i], 0);
todo_wine_if(text_len == 8) todo_wine_if(is_wow64)
ok(ret == text_len, "Unexpected return value %d.\n", ret); ok(ret == text_len, "Unexpected return value %d.\n", ret);
memset(&data, 0xee, sizeof(data)); memset(&data, 0xee, sizeof(data));
ret = SendMessageA(listbox, LB_GETTEXT, valid_idx[i], (LPARAM)&data); ret = SendMessageA(listbox, LB_GETTEXT, valid_idx[i], (LPARAM)&data);
todo_wine_if(sizeof(void *) == 8)
ok(ret == sizeof(data), "Unexpected return value %d.\n", ret); ok(ret == sizeof(data), "Unexpected return value %d.\n", ret);
todo_wine todo_wine
ok(!memcmp(&data, &zero_data, sizeof(data)), "Unexpected item data.\n"); ok(!memcmp(&data, &zero_data, sizeof(data)), "Unexpected item data.\n");