Owen Rudge : shell32: Implement SHGetImageList and remove todo_wine from imagelist tests.

Alexandre Julliard julliard at winehq.org
Tue Nov 17 09:28:18 CST 2009


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

Author: Owen Rudge <orudge at codeweavers.com>
Date:   Mon Nov 16 13:27:32 2009 -0600

shell32: Implement SHGetImageList and remove todo_wine from imagelist tests.

---

 dlls/comctl32/tests/imagelist.c |    6 +++---
 dlls/shell32/shellord.c         |   36 ++++++++++++++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index 36d0aea..38a3b48 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -1012,18 +1012,18 @@ static void test_shell_imagelist(void)
     /* Get system image list */
     hr = (pSHGetImageList)(SHIL_LARGE, &IID_IImageList, (void**)&iml);
 
-    todo_wine ok(SUCCEEDED(hr), "SHGetImageList failed, hr=%x\n", hr);
+    ok(SUCCEEDED(hr), "SHGetImageList failed, hr=%x\n", hr);
 
     if (hr != S_OK)
         return;
 
     IImageList_GetImageCount(iml, &out);
-    todo_wine ok(out > 0, "IImageList_GetImageCount returned out <= 0\n");
+    ok(out > 0, "IImageList_GetImageCount returned out <= 0\n");
 
     /* right and bottom should be 32x32 for large icons, or 48x48 if larger
        icons enabled in control panel */
     IImageList_GetImageRect(iml, 0, &rect);
-    todo_wine ok((((rect.right == 32) && (rect.bottom == 32)) ||
+    ok((((rect.right == 32) && (rect.bottom == 32)) ||
                   ((rect.right == 48) && (rect.bottom == 48))),
                  "IImageList_GetImageRect returned r:%d,b:%d\n",
                  rect.right, rect.bottom);
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c
index 29b77df..7aa3a0c 100644
--- a/dlls/shell32/shellord.c
+++ b/dlls/shell32/shellord.c
@@ -46,6 +46,7 @@
 #include "pidl.h"
 #include "shlwapi.h"
 #include "commdlg.h"
+#include "commoncontrols.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 WINE_DECLARE_DEBUG_CHANNEL(pidl);
@@ -2173,10 +2174,41 @@ void WINAPI SHFlushSFCache(void)
 {
 }
 
+/*************************************************************************
+ *              SHGetImageList (SHELL32.727)
+ *
+ * Returns a copy of a shell image list.
+ *
+ * NOTES
+ *   Windows XP features 4 sizes of image list, and Vista 5. Wine currently
+ *   only supports 2, so requests for the others will currently fail.
+ */
 HRESULT WINAPI SHGetImageList(int iImageList, REFIID riid, void **ppv)
 {
-    FIXME("STUB: %i %s\n",iImageList,debugstr_guid(riid));
-    return E_NOINTERFACE;
+    HIMAGELIST hLarge, hSmall;
+    HIMAGELIST hNew;
+    HRESULT ret = E_FAIL;
+
+    /* Wine currently only maintains large and small image lists */
+    if ((iImageList != SHIL_LARGE) && (iImageList != SHIL_SMALL))
+    {
+        FIXME("Unsupported image list %i requested\n", iImageList);
+        return E_FAIL;
+    }
+
+    Shell_GetImageList(&hLarge, &hSmall);
+    hNew = ImageList_Duplicate(iImageList == SHIL_LARGE ? hLarge : hSmall);
+
+    /* Get the interface for the new image list */
+    if (hNew)
+    {
+        ret = HIMAGELIST_QueryInterface(hNew, riid, ppv);
+
+        if (!SUCCEEDED(ret))
+            ImageList_Destroy(hNew);
+    }
+
+    return ret;
 }
 
 /*************************************************************************




More information about the wine-cvs mailing list