Hans Leidekker : shell32: Forward ShExtractIconsW to user32.PrivateExtractIconsW.

Alexandre Julliard julliard at winehq.org
Tue Mar 25 14:27:43 CDT 2014


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Mar 25 12:53:27 2014 +0100

shell32: Forward ShExtractIconsW to user32.PrivateExtractIconsW.

---

 dlls/shell32/shell32.spec      |    2 +-
 dlls/shell32/tests/shelllink.c |   60 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec
index c5405d4..d73dcbb 100644
--- a/dlls/shell32/shell32.spec
+++ b/dlls/shell32/shell32.spec
@@ -347,7 +347,7 @@
 @ stdcall SHCreateShellItemArrayFromShellItem(ptr ptr ptr)
 @ stdcall SHEmptyRecycleBinA(long str long)
 @ stdcall SHEmptyRecycleBinW(long wstr long)
-@ stub SHExtractIconsW
+@ stdcall SHExtractIconsW(wstr long long long ptr ptr long long) user32.PrivateExtractIconsW
 @ stdcall SHFileOperation(ptr) SHFileOperationA
 @ stdcall SHFileOperationA(ptr)
 @ stdcall SHFileOperationW(ptr)
diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c
index c62f575..0b2b7be 100644
--- a/dlls/shell32/tests/shelllink.c
+++ b/dlls/shell32/tests/shelllink.c
@@ -42,6 +42,7 @@ static HRESULT (WINAPI *pSHDefExtractIconA)(LPCSTR, int, UINT, HICON*, HICON*, U
 static HRESULT (WINAPI *pSHGetStockIconInfo)(SHSTOCKICONID, UINT, SHSTOCKICONINFO *);
 static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD);
 static DWORD (WINAPI *pGetShortPathNameA)(LPCSTR, LPSTR, DWORD);
+static UINT (WINAPI *pSHExtractIconsW)(LPCWSTR, int, int, int, HICON *, UINT *, UINT, UINT);
 
 static const GUID _IID_IShellLinkDataList = {
     0x45e2b4ae, 0xb1c3, 0x11d0,
@@ -1095,6 +1096,63 @@ static void test_SHGetStockIconInfo(void)
     ok(hr == E_INVALIDARG, "NULL: got 0x%x\n", hr);
 }
 
+static void test_SHExtractIcons(void)
+{
+    static const WCHAR notepadW[] = {'n','o','t','e','p','a','d','.','e','x','e',0};
+    static const WCHAR shell32W[] = {'s','h','e','l','l','3','2','.','d','l','l',0};
+    static const WCHAR emptyW[] = {0};
+    UINT ret, ret2;
+    HICON icons[256];
+    UINT ids[256], i;
+
+    if (!pSHExtractIconsW)
+    {
+        win_skip("SHExtractIconsW not available\n");
+        return;
+    }
+
+    ret = pSHExtractIconsW(emptyW, 0, 16, 16, icons, ids, 1, 0);
+    ok(ret == ~0u, "got %u\n", ret);
+
+    ret = pSHExtractIconsW(notepadW, 0, 16, 16, NULL, NULL, 1, 0);
+    ok(ret == 1 || broken(ret == 2) /* win2k */, "got %u\n", ret);
+
+    icons[0] = (HICON)0xdeadbeef;
+    ret = pSHExtractIconsW(notepadW, 0, 16, 16, icons, NULL, 1, 0);
+    ok(ret == 1, "got %u\n", ret);
+    ok(icons[0] != (HICON)0xdeadbeef, "icon not set\n");
+    DestroyIcon(icons[0]);
+
+    icons[0] = (HICON)0xdeadbeef;
+    ids[0] = 0xdeadbeef;
+    ret = pSHExtractIconsW(notepadW, 0, 16, 16, icons, ids, 1, 0);
+    ok(ret == 1, "got %u\n", ret);
+    ok(icons[0] != (HICON)0xdeadbeef, "icon not set\n");
+    ok(ids[0] != 0xdeadbeef, "id not set\n");
+    DestroyIcon(icons[0]);
+
+    ret = pSHExtractIconsW(shell32W, 0, 16, 16, NULL, NULL, 0, 0);
+    ret2 = pSHExtractIconsW(shell32W, 4, MAKELONG(32,16), MAKELONG(32,16), NULL, NULL, 256, 0);
+    ok(ret && ret == ret2,
+       "icon count should be independent of requested icon sizes and base icon index\n");
+
+    ret = pSHExtractIconsW(shell32W, 0, 16, 16, icons, ids, 0, 0);
+    ok(ret == ~0u || !ret /* < vista */, "got %u\n", ret);
+
+    ret = pSHExtractIconsW(shell32W, 0, 16, 16, icons, ids, 3, 0);
+    ok(ret == 3, "got %u\n", ret);
+    for (i = 0; i < ret; i++) DestroyIcon(icons[i]);
+
+    /* count must be a multiple of two when getting two sizes */
+    ret = pSHExtractIconsW(shell32W, 0, MAKELONG(16,32), MAKELONG(16,32), icons, ids, 3, 0);
+    ok(!ret /* vista */ || ret == 4, "got %u\n", ret);
+    for (i = 0; i < ret; i++) DestroyIcon(icons[i]);
+
+    ret = pSHExtractIconsW(shell32W, 0, MAKELONG(16,32), MAKELONG(16,32), icons, ids, 4, 0);
+    ok(ret == 4, "got %u\n", ret);
+    for (i = 0; i < ret; i++) DestroyIcon(icons[i]);
+}
+
 START_TEST(shelllink)
 {
     HRESULT r;
@@ -1108,6 +1166,7 @@ START_TEST(shelllink)
     pSHGetStockIconInfo = (void *)GetProcAddress(hmod, "SHGetStockIconInfo");
     pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA");
     pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA");
+    pSHExtractIconsW = (void *)GetProcAddress(hmod, "SHExtractIconsW");
 
     r = CoInitialize(NULL);
     ok(r == S_OK, "CoInitialize failed (0x%08x)\n", r);
@@ -1120,6 +1179,7 @@ START_TEST(shelllink)
     test_shdefextracticon();
     test_GetIconLocation();
     test_SHGetStockIconInfo();
+    test_SHExtractIcons();
 
     CoUninitialize();
 }




More information about the wine-cvs mailing list