Nikolay Sivov : comctl32/imagelist: Fix failure code for IImageList_Draw().
Module: wine Branch: master Commit: 5ee4441c15fd57348a149e1a71bbbca87b14e9a0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5ee4441c15fd57348a149e1a71... Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Thu Aug 19 09:42:44 2010 +0400 comctl32/imagelist: Fix failure code for IImageList_Draw(). --- dlls/comctl32/imagelist.c | 9 +++------ dlls/comctl32/tests/imagelist.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 47279c9..c37c7a0 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -3298,11 +3298,8 @@ static HRESULT WINAPI ImageListImpl_Draw(IImageList *iface, IMAGELISTDRAWPARAMS *pimldp) { HIMAGELIST This = (HIMAGELIST) iface; - HIMAGELIST old_himl = 0; - int ret = 0; - - if (!pimldp) - return E_FAIL; + HIMAGELIST old_himl; + int ret; /* As far as I can tell, Windows simply ignores the contents of pimldp->himl so we shall simulate the same */ @@ -3312,7 +3309,7 @@ static HRESULT WINAPI ImageListImpl_Draw(IImageList *iface, ret = ImageList_DrawIndirect(pimldp); pimldp->himl = old_himl; - return ret ? S_OK : E_FAIL; + return ret ? S_OK : E_INVALIDARG; } static HRESULT WINAPI ImageListImpl_Remove(IImageList *iface, int i) diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c index de6d2c3..191b796 100644 --- a/dlls/comctl32/tests/imagelist.c +++ b/dlls/comctl32/tests/imagelist.c @@ -1596,9 +1596,15 @@ static void test_IImageList_Draw(void) ok( IImageList_SetImageCount(imgl, 3) == S_OK, "Setimage count failed\n"); ok( IImageList_Replace(imgl, 2, hbm3, 0) == S_OK, "failed to replace bitmap 3\n"); +if (0) +{ + /* crashes on native */ + hr = IImageList_Draw(imgl, NULL); +} + memset(&imldp, 0, sizeof (imldp)); hr = IImageList_Draw(imgl, &imldp); - todo_wine ok( hr == E_INVALIDARG, "got 0x%08x\n", hr); + ok( hr == E_INVALIDARG, "got 0x%08x\n", hr); imldp.cbSize = IMAGELISTDRAWPARAMS_V3_SIZE; imldp.hdcDst = hdc; @@ -1618,7 +1624,7 @@ static void test_IImageList_Draw(void) imldp.i ++; ok( IImageList_Draw(imgl, &imldp) == S_OK, "should succeed\n"); imldp.i ++; - todo_wine ok( IImageList_Draw(imgl, &imldp) == E_INVALIDARG, "should fail\n"); + ok( IImageList_Draw(imgl, &imldp) == E_INVALIDARG, "should fail\n"); /* remove three */ ok( IImageList_Remove(imgl, 0) == S_OK, "removing 1st bitmap\n");
participants (1)
-
Alexandre Julliard