Nikolay Sivov : comctl32/imagelist: Remove parameter check from IImageList_Clone().

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


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

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

comctl32/imagelist: Remove parameter check from IImageList_Clone().

---

 dlls/comctl32/imagelist.c       |    6 ++----
 dlls/comctl32/tests/imagelist.c |   23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 162d0d3..34cf7d3 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -3389,15 +3389,13 @@ static HRESULT WINAPI ImageListImpl_Merge(IImageList *iface, int i1,
     return ret;
 }
 
-static HRESULT WINAPI ImageListImpl_Clone(IImageList *iface, REFIID riid,
-    PVOID *ppv)
+static HRESULT WINAPI ImageListImpl_Clone(IImageList *iface, REFIID riid, void **ppv)
 {
     HIMAGELIST This = (HIMAGELIST) iface;
     HIMAGELIST hNew;
     HRESULT ret = E_FAIL;
 
-    if (!ppv)
-        return E_FAIL;
+    TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
 
     hNew = ImageList_Duplicate(This);
 
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index 3530932..a4dae03 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -1778,6 +1778,28 @@ static void test_create(void)
     ok(himl == NULL, "got %p\n", himl);
 }
 
+static void test_IImageList_Clone(void)
+{
+    IImageList *imgl, *imgl2;
+    HIMAGELIST himl;
+    HRESULT hr;
+
+    himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3);
+    imgl = (IImageList*)himl;
+
+if (0)
+{
+    /* crashes on native */
+    hr = IImageList_Clone(imgl, &IID_IImageList, NULL);
+}
+
+    hr = IImageList_Clone(imgl, &IID_IImageList, (void**)&imgl2);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    IImageList_Release(imgl2);
+
+    IImageList_Release(imgl);
+}
+
 START_TEST(imagelist)
 {
     ULONG_PTR ctx_cookie;
@@ -1830,6 +1852,7 @@ START_TEST(imagelist)
     test_IImageList_Get_SetImageCount();
     test_IImageList_Draw();
     test_IImageList_Merge();
+    test_IImageList_Clone();
 
     CoUninitialize();
 




More information about the wine-cvs mailing list