diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 89333bfa8c5..9396b956085 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3431,7 +3431,7 @@ static HRESULT WINAPI ImageListImpl_GetIconSize(IImageList *iface, int *cx, { HIMAGELIST This = (HIMAGELIST) iface; - return ImageList_GetIconSize(This, cx, cy) ? S_OK : E_FAIL; + return ImageList_GetIconSize(This, cx, cy) ? S_OK : E_INVALIDARG; } static HRESULT WINAPI ImageListImpl_SetIconSize(IImageList *iface, int cx, @@ -3442,9 +3442,6 @@ static HRESULT WINAPI ImageListImpl_SetIconSize(IImageList *iface, int cx, static HRESULT WINAPI ImageListImpl_GetImageCount(IImageList *iface, int *pi) { - if (!pi) - return E_FAIL; - *pi = ImageList_GetImageCount((HIMAGELIST) iface); return S_OK; } diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index ff3ada4f5b5..c5ea95f5124 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1863,6 +1863,52 @@ if (0) IImageList_Release(imgl); } +static void test_IImageList_GetImageCount(void) +{ + IImageList *imgl; + HIMAGELIST himl; + int count; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + +if (0) +{ + /* crashes on native */ + hr = IImageList_GetImageCount(imgl, NULL); +} + + count = -1; + hr = IImageList_GetImageCount(imgl, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count == 0, "got %d\n", count); + + IImageList_Release(imgl); +} + +static void test_IImageList_GetIconSize(void) +{ + IImageList *imgl; + HIMAGELIST himl; + int cx, cy; + HRESULT hr; + + himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3); + imgl = (IImageList*)himl; + + hr = IImageList_GetIconSize(imgl, NULL, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IImageList_GetIconSize(imgl, &cx, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IImageList_GetIconSize(imgl, NULL, &cy); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + IImageList_Release(imgl); +} + START_TEST(imagelist) { ULONG_PTR ctx_cookie; @@ -1918,6 +1964,8 @@ START_TEST(imagelist) test_IImageList_Clone(); test_IImageList_GetBkColor(); test_IImageList_SetBkColor(); + test_IImageList_GetImageCount(); + test_IImageList_GetIconSize(); CoUninitialize();