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

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


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

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

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

---

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

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 7133d2f..f110787 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -3467,9 +3467,6 @@ static HRESULT WINAPI ImageListImpl_SetBkColor(IImageList *iface, COLORREF clrBk
 
 static HRESULT WINAPI ImageListImpl_GetBkColor(IImageList *iface, COLORREF *pclr)
 {
-    if (!pclr)
-        return E_FAIL;
-
     *pclr = ImageList_GetBkColor((HIMAGELIST) iface);
     return S_OK;
 }
@@ -3649,11 +3646,9 @@ static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID ii
 
     if (pUnkOuter) return CLASS_E_NOAGGREGATION;
 
-    This = HeapAlloc(GetProcessHeap(), 0, sizeof(struct _IMAGELIST));
+    This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct _IMAGELIST));
     if (!This) return E_OUTOFMEMORY;
 
-    ZeroMemory(This, sizeof(struct _IMAGELIST));
-
     This->lpVtbl = &ImageListImpl_Vtbl;
     This->ref = 1;
 
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index 210f9ec..dc1c0c8 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -1811,6 +1811,28 @@ if (0)
     IImageList_Release(imgl);
 }
 
+static void test_IImageList_GetBkColor(void)
+{
+    IImageList *imgl;
+    HIMAGELIST himl;
+    COLORREF color;
+    HRESULT hr;
+
+    himl = ImageList_Create(16, 16, ILC_COLOR16, 0, 3);
+    imgl = (IImageList*)himl;
+
+if (0)
+{
+    /* crashes on native */
+    hr = IImageList_GetBkColor(imgl, NULL);
+}
+
+    hr = IImageList_GetBkColor(imgl, &color);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    IImageList_Release(imgl);
+}
+
 START_TEST(imagelist)
 {
     ULONG_PTR ctx_cookie;
@@ -1864,6 +1886,7 @@ START_TEST(imagelist)
     test_IImageList_Draw();
     test_IImageList_Merge();
     test_IImageList_Clone();
+    test_IImageList_GetBkColor();
 
     CoUninitialize();
 




More information about the wine-cvs mailing list