Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/comctl32/listbox.c | 6 +++--- dlls/comctl32/tests/listbox.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index 4a2df52..76b09aa 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -762,8 +762,8 @@ static LRESULT LISTBOX_GetText( LB_DESCR *descr, INT index, LPWSTR buffer, BOOL } else { if (buffer) - *((DWORD *)buffer) = *(DWORD *)&descr->items[index].data; - len = sizeof(DWORD); + *((ULONG_PTR *)buffer) = descr->items[index].data; + len = sizeof(ULONG_PTR); } return len; } @@ -2653,7 +2653,7 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam, SetLastError(ERROR_INVALID_INDEX); return LB_ERR; } - if (!HAS_STRINGS(descr)) return sizeof(DWORD); + if (!HAS_STRINGS(descr)) return sizeof(ULONG_PTR); return strlenW( descr->items[wParam].str );
case LB_GETCURSEL: diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index 6ac3c73..802dd98 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -2296,12 +2296,11 @@ static void test_LBS_NODATA(void) ret = SendMessageA(listbox, LB_SETITEMDATA, valid_idx[i], 42); ok(ret == TRUE, "Unexpected return value %d.\n", ret); 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);
memset(&data, 0xee, sizeof(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); todo_wine ok(!memcmp(&data, &zero_data, sizeof(data)), "Unexpected item data.\n");
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/comctl32/listbox.c | 3 ++- dlls/comctl32/tests/listbox.c | 1 - 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index 76b09aa..aa42c3a 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -762,7 +762,8 @@ static LRESULT LISTBOX_GetText( LB_DESCR *descr, INT index, LPWSTR buffer, BOOL } else { if (buffer) - *((ULONG_PTR *)buffer) = descr->items[index].data; + *((ULONG_PTR *)buffer) = (descr->style & LBS_NODATA) + ? 0 : descr->items[index].data; len = sizeof(ULONG_PTR); } return len; diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index 802dd98..8620ca3 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -2302,7 +2302,6 @@ static void test_LBS_NODATA(void) memset(&data, 0xee, sizeof(data)); ret = SendMessageA(listbox, LB_GETTEXT, valid_idx[i], (LPARAM)&data); ok(ret == sizeof(data), "Unexpected return value %d.\n", ret); - todo_wine ok(!memcmp(&data, &zero_data, sizeof(data)), "Unexpected item data.\n");
ret = SendMessageA(listbox, LB_GETITEMDATA, valid_idx[i], 0);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/comctl32/listbox.c | 2 +- dlls/comctl32/tests/listbox.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index aa42c3a..03afc5e 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -2630,7 +2630,7 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam, SetLastError(ERROR_INVALID_INDEX); return LB_ERR; } - return descr->items[wParam].data; + return (descr->style & LBS_NODATA) ? 0 : descr->items[wParam].data;
case LB_SETITEMDATA: if (((INT)wParam < 0) || ((INT)wParam >= descr->nb_items)) diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index 8620ca3..e507688 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -2305,7 +2305,6 @@ static void test_LBS_NODATA(void) ok(!memcmp(&data, &zero_data, sizeof(data)), "Unexpected item data.\n");
ret = SendMessageA(listbox, LB_GETITEMDATA, valid_idx[i], 0); - todo_wine ok(ret == 0, "Unexpected return value %d.\n", ret); }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/comctl32/listbox.c | 2 +- dlls/comctl32/tests/listbox.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index 03afc5e..479f6a6 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -2638,7 +2638,7 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam, SetLastError(ERROR_INVALID_INDEX); return LB_ERR; } - descr->items[wParam].data = lParam; + if (!(descr->style & LBS_NODATA)) descr->items[wParam].data = lParam; /* undocumented: returns TRUE, not LB_OKAY (0) */ return TRUE;
diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index e507688..271cbca 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -2310,13 +2310,10 @@ static void test_LBS_NODATA(void)
/* More messages that don't work with LBS_NODATA. */ ret = SendMessageA(listbox, LB_FINDSTRING, 1, 42); -todo_wine ok(ret == LB_ERR, "Unexpected return value %d.\n", ret); ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 42); -todo_wine ok(ret == LB_ERR, "Unexpected return value %d.\n", ret); ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 42); -todo_wine ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
DestroyWindow(listbox);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/comctl32/listbox.c | 2 ++ dlls/comctl32/tests/listbox.c | 6 ++++++ 2 files changed, 8 insertions(+)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index 479f6a6..dbc7b4a 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -880,6 +880,8 @@ static INT LISTBOX_FindString( LB_DESCR *descr, INT start, LPCWSTR str, BOOL exa INT i; LB_ITEMDATA *item;
+ if (descr->style & LBS_NODATA) return LB_ERR; + if (start >= descr->nb_items) start = -1; item = descr->items + start + 1; if (HAS_STRINGS(descr)) diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index 271cbca..43da3ca 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -2309,10 +2309,16 @@ static void test_LBS_NODATA(void) }
/* More messages that don't work with LBS_NODATA. */ + ret = SendMessageA(listbox, LB_FINDSTRING, 1, 0); + ok(ret == LB_ERR, "Unexpected return value %d.\n", ret); ret = SendMessageA(listbox, LB_FINDSTRING, 1, 42); ok(ret == LB_ERR, "Unexpected return value %d.\n", ret); + ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 0); + ok(ret == LB_ERR, "Unexpected return value %d.\n", ret); ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 42); ok(ret == LB_ERR, "Unexpected return value %d.\n", ret); + ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 0); + ok(ret == LB_ERR, "Unexpected return value %d.\n", ret); ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 42); ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com