diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c index d60a4405391..2ced4eadfc2 100644 --- a/dlls/shell32/iconcache.c +++ b/dlls/shell32/iconcache.c @@ -534,3 +534,44 @@ HICON WINAPI ExtractAssociatedIconExA(HINSTANCE hInst, LPSTR lpIconPath, LPWORD HeapFree(GetProcessHeap(), 0, lpwstrFile); return ret; } + + +/**************************************************************************** + * SHDefExtractIconW [SHELL32.@] + */ +HRESULT WINAPI SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, + HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize) +{ + UINT ret; + HICON hIcons[2]; + WARN("%s %d 0x%08x %p %p %d, semi-stub\n", debugstr_w(pszIconFile), iIndex, uFlags, phiconLarge, phiconSmall, nIconSize); + + ret = PrivateExtractIconsW(pszIconFile, iIndex, nIconSize, nIconSize, hIcons, NULL, 2, LR_DEFAULTCOLOR); + /* FIXME: deal with uFlags parameter which contains GIL_ flags */ + if (ret == 0xFFFFFFFF) + return E_FAIL; + if (ret > 0) { + *phiconLarge = hIcons[0]; + *phiconSmall = hIcons[1]; + return S_OK; + } + return S_FALSE; +} + +/**************************************************************************** + * SHDefExtractIconA [SHELL32.@] + */ +HRESULT WINAPI SHDefExtractIconA(LPCSTR pszIconFile, int iIndex, UINT uFlags, + HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize) +{ + HRESULT ret; + INT len = MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, NULL, 0); + LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + + TRACE("%s %d 0x%08x %p %p %d\n", pszIconFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize); + + MultiByteToWideChar(CP_ACP, 0, pszIconFile, -1, lpwstrFile, len); + ret = SHDefExtractIconW(lpwstrFile, iIndex, uFlags, phiconLarge, phiconSmall, nIconSize); + HeapFree(GetProcessHeap(), 0, lpwstrFile); + return ret; +} diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec index deed19b63df..5606637e2db 100644 --- a/dlls/shell32/shell32.spec +++ b/dlls/shell32/shell32.spec @@ -411,3 +411,8 @@ @ stdcall SHGetFolderPathA(long long long long ptr)SHGetFolderPathA @ stdcall SHGetFolderPathW(long long long long ptr)SHGetFolderPathW @ stdcall SHGetFolderLocation(long long long long ptr)SHGetFolderLocation + +# version 6.0 (WinXP) +# _WIN32_IE >= 0x600 +@ stdcall SHDefExtractIconA(str long long ptr ptr long) SHDefExtractIconA +@ stdcall SHDefExtractIconW(wstr long long ptr ptr long) SHDefExtractIconW diff --git a/include/shlobj.h b/include/shlobj.h index 0107df52acb..04376d94af4 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -569,6 +569,15 @@ HRESULT WINAPI SHGetSpecialFolderLocation(HWND, INT, LPITEMIDLIST *); #define CSIDL_FLAG_MASK 0xff00 +/**************************************************************************** +* SHDefExtractIcon API +*/ +HRESULT WINAPI SHDefExtractIconA(LPCSTR pszIconFile, int iIndex, UINT uFlags, + HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize); +HRESULT WINAPI SHDefExtractIconW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, + HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize); +#define SHDefExtractIcon WINELIB_NAME_AW(SHDefExtractIcon) + /* * DROPFILES for CF_HDROP and CF_PRINTERS */