From: Zhiyi Zhang <zzhang@codeweavers.com> Some applications mistakenly use a very large initial image count, for example, 0xc0c0c0. Treat the user specified initial image count only as a suggestion and use something reasonable when such cases happen. 256 initial images should be enough for most cases. Otherwise, CreateDIBSection() fails to create the internal bitmap due to invalid image dimensions. This doesn't change how large an image list can grow. --- dlls/comctl32/imagelist.c | 3 +++ dlls/comctl32/tests/imagelist.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index ba340645db8..6650e3db04b 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3663,6 +3663,9 @@ static HRESULT WINAPI ImageListImpl_Initialize(IImageList2 *iface, INT cx, INT c grow = 256; } + /* Some applications mistakenly use a very large initial image count. Limit it to something reasonable */ + initial = min(initial, 256); + himl->cx = cx; himl->cy = cy; himl->flags = flags; diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index c2b04f622a4..1921567627f 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -2274,7 +2274,6 @@ static void test_create_destroy(void) ok(ret != -1, "Failed to add an image.\n"); ret = pImageList_GetImageInfo(himl, 0, &info); ok(ret, "got %d\n", ret); - todo_wine ok(info.hbmImage != NULL, "got %p\n", info.hbmImage); DeleteObject(hbm); pImageList_Destroy(himl); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10382