From 58c04dafae182cbb9840f13663d99a1c70e584c7 Mon Sep 17 00:00:00 2001 From: Rolf Kalbermatter Date: Tue, 10 Dec 2002 19:10:11 +0000 Subject: [PATCH] Change the return value for ExtractIconEx from HICON to UINT and make the function call directly user32.PrivateExtractIconEx. --- dlls/shell32/iconcache.c | 42 ++++++++-------------------------------- include/shellapi.h | 6 +++--- 2 files changed, 11 insertions(+), 37 deletions(-) diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c index 2ced4eadfc2..82206613555 100644 --- a/dlls/shell32/iconcache.c +++ b/dlls/shell32/iconcache.c @@ -397,7 +397,7 @@ INT WINAPI Shell_GetCachedImageIndexAW(LPCVOID szPath, INT nIndex, BOOL bSimulat /************************************************************************* * ExtractIconEx [SHELL32.@] */ -HICON WINAPI ExtractIconExAW ( LPCVOID lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons ) +UINT WINAPI ExtractIconExAW(LPCVOID lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons) { if (SHELL_OsIsUnicode()) return ExtractIconExW ( lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons); return ExtractIconExA ( lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons); @@ -407,48 +407,22 @@ HICON WINAPI ExtractIconExAW ( LPCVOID lpszFile, INT nIconIndex, HICON * phiconL * ExtractIconExW [SHELL32.@] * RETURNS: * 0 no icon found - * 1 file is not valid - * HICON handle of a icon (phiconLarge/Small == NULL) + * -1 file is not valid + * or number of icons extracted */ -HICON WINAPI ExtractIconExW( LPCWSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons ) +UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons) { - HICON ret = 0; + TRACE("%s %i %p %p %i\n", debugstr_w(lpszFile), nIconIndex, phiconLarge, phiconSmall, nIcons); - TRACE("%s %i %p %p %i\n", debugstr_w(lpszFile), nIconIndex, phiconLarge, phiconSmall, nIcons); - - if (phiconLarge && !phiconSmall && nIconIndex == -1) /* Number of icons requested */ - return (HICON)PrivateExtractIconsW(lpszFile, 0, 0, 0, NULL, NULL, 0, 0); - - if (phiconLarge) - { - ret = (HICON)PrivateExtractIconsW(lpszFile, nIconIndex, 32, 32, phiconLarge, NULL, nIcons, 0); - if (nIcons==1) - { - ret = phiconLarge[0]; - } - } - - /* if no pointers given and one icon expected, return the handle directly */ - if (!phiconLarge && !phiconSmall && nIcons==1) - phiconSmall = &ret; - - if (phiconSmall) - { - ret = (HICON)PrivateExtractIconsW(lpszFile, nIconIndex, 16, 16, phiconSmall, NULL, nIcons, 0); - if (nIcons==1) - { - ret = phiconSmall[0]; - } - } - return ret; + return PrivateExtractIconExW(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons); } /************************************************************************* * ExtractIconExA [SHELL32.@] */ -HICON WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons ) +UINT WINAPI ExtractIconExA(LPCSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons) { - HICON ret; + UINT ret; INT len = MultiByteToWideChar(CP_ACP, 0, lpszFile, -1, NULL, 0); LPWSTR lpwstrFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); diff --git a/include/shellapi.h b/include/shellapi.h index e22bbc11ad9..907368dd9b7 100644 --- a/include/shellapi.h +++ b/include/shellapi.h @@ -273,10 +273,10 @@ HICON WINAPI ExtractAssociatedIconW(HINSTANCE,LPWSTR,LPWORD); HICON WINAPI ExtractAssociatedIconExA(HINSTANCE,LPSTR,LPWORD,LPWORD); HICON WINAPI ExtractAssociatedIconExW(HINSTANCE,LPWSTR,LPWORD,LPWORD); #define ExtractAssociatedIconEx WINELIB_NAME_AW(ExtractAssociatedIconEx) -HICON WINAPI ExtractIconExA( LPCSTR, INT, HICON *, HICON *, UINT ); -HICON WINAPI ExtractIconExW( LPCWSTR, INT, HICON *, HICON *, UINT ); +UINT WINAPI ExtractIconExA(LPCSTR,INT,HICON*,HICON*,UINT); +UINT WINAPI ExtractIconExW(LPCWSTR,INT,HICON*,HICON*,UINT); #define ExtractIconEx WINELIB_NAME_AW(ExtractIconEx) -HICON WINAPI ExtractIconExAW(LPCVOID, INT, HICON *, HICON *, UINT ); +UINT WINAPI ExtractIconExAW(LPCVOID,INT,HICON*,HICON*,UINT); HINSTANCE WINAPI FindExecutableA(LPCSTR,LPCSTR,LPSTR); HINSTANCE WINAPI FindExecutableW(LPCWSTR,LPCWSTR,LPWSTR); #define FindExecutable WINELIB_NAME_AW(FindExecutable)