shell32: Forward ShExtractIconsW to user32.PrivateExtractIconsW.

This commit is contained in:
Hans Leidekker 2014-03-25 12:53:27 +01:00 committed by Alexandre Julliard
parent fb31e0fbe3
commit 86bd0603a2
2 changed files with 61 additions and 1 deletions

View File

@ -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)

View File

@ -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();
}