Nikolay Sivov : comctl32/imagelist: Make IImageList_Merge() crash like it does on native.

Alexandre Julliard julliard at winehq.org
Mon Aug 23 10:50:17 CDT 2010


Module: wine
Branch: master
Commit: eb2aae669ca16affd019c02bcbc0dda1d19b34b3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=eb2aae669ca16affd019c02bcbc0dda1d19b34b3

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Aug 21 19:08:54 2010 +0400

comctl32/imagelist: Make IImageList_Merge() crash like it does on native.

---

 dlls/comctl32/imagelist.c       |    5 ++---
 dlls/comctl32/tests/imagelist.c |    7 +++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 2218d99..162d0d3 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -3365,15 +3365,14 @@ static HRESULT WINAPI ImageListImpl_Copy(IImageList *iface, int iDst,
 }
 
 static HRESULT WINAPI ImageListImpl_Merge(IImageList *iface, int i1,
-    IUnknown *punk2, int i2, int dx, int dy, REFIID riid, PVOID *ppv)
+    IUnknown *punk2, int i2, int dx, int dy, REFIID riid, void **ppv)
 {
     HIMAGELIST This = (HIMAGELIST) iface;
     IImageList *iml2 = NULL;
     HIMAGELIST hNew;
     HRESULT ret = E_FAIL;
 
-    if (!punk2 || !ppv)
-        return E_FAIL;
+    TRACE("(%p)->(%d %p %d %d %d %s %p)\n", iface, i1, punk2, i2, dx, dy, debugstr_guid(riid), ppv);
 
     /* TODO: Add test for IID_ImageList2 too */
     if (FAILED(IImageList_QueryInterface(punk2, &IID_IImageList,
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index 26c7e12..3530932 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -1674,6 +1674,13 @@ static void test_IImageList_Merge(void)
     ret = -1;
     ok( IImageList_ReplaceIcon(imgl2, -1, hicon1, &ret) == S_OK && (ret == 0),"add icon1 to himl2 failed\n");
 
+if (0)
+{
+    /* null cases that crash on native */
+    hr = IImageList_Merge(imgl1, -1, NULL, 0, 0, 0, &IID_IImageList, (void**)&merge);
+    hr = IImageList_Merge(imgl1, -1, (IUnknown*) imgl2, 0, 0, 0, &IID_IImageList, NULL);
+}
+
     /* If himl1 has no images, merge still succeeds */
     hr = IImageList_Merge(imgl1, -1, (IUnknown *) imgl2, 0, 0, 0, &IID_IImageList, (void **) &merge);
     ok(hr == S_OK, "merge himl1,-1 failed\n");




More information about the wine-cvs mailing list