[PATCH 3/7] Fix failure code for IImageList_Draw()

Nikolay Sivov nsivov at codeweavers.com
Thu Aug 19 00:42:44 CDT 2010


---
 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");
-- 
1.5.6.5



--------------070609010909000608060501--



More information about the wine-patches mailing list