shell32 patch 22
Martin Fuchs
martin-fuchs at gmx.net
Wed Jan 28 16:43:10 CST 2004
Changelog:
- SIC_LoadIcon(): link at runtime to undocumented function PrivateExtractIconExA()
using GetProcAddress() in MinGW and MSVC environment, as the function is missing in the lib files
- SIC_GetIconIndex(): correct documentation header
- SHMapPIDLToSystemImageListInd(): set *pIndex to -1 if big icon could not be loaded
- ExtractIconExW(): link at runtime to undocumented function PrivateExtractIconExW()
for MinGW and MSVC
Index: iconcache.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/iconcache.c,v
retrieving revision 1.73
diff -u -p -d -w -b -r1.73 iconcache.c
--- iconcache.c 21 Jan 2004 22:15:09 -0000 1.73
+++ iconcache.c 28 Jan 2004 22:42:14 -0000
@@ -143,8 +143,22 @@ static INT SIC_LoadIcon (LPCSTR sSourceF
{ HICON hiconLarge=0;
HICON hiconSmall=0;
- PrivateExtractIconsA( sSourceFile, dwSourceIndex, 32, 32, &hiconLarge, 0, 1, 0 );
- PrivateExtractIconsA( sSourceFile, dwSourceIndex, 16, 16, &hiconSmall, 0, 1, 0 );
+#if defined (__MINGW32__) || defined(_MSC_VER)
+ static UINT (WINAPI*PrivateExtractIconExA)(LPCSTR,int,HICON*,HICON*,UINT) = NULL;
+
+ if (!PrivateExtractIconExA) {
+ HMODULE hUser32 = GetModuleHandleA("user32");
+ PrivateExtractIconExA = (UINT(WINAPI*)(LPCSTR,int,HICON*,HICON*,UINT)) GetProcAddress(hUser32, "PrivateExtractIconExA");
+ }
+
+ if (PrivateExtractIconExA)
+ PrivateExtractIconExA(sSourceFile, dwSourceIndex, &hiconLarge, &hiconSmall, 1);
+ else
+#endif
+ {
+ PrivateExtractIconsA(sSourceFile, dwSourceIndex, 32, 32, &hiconLarge, NULL, 1, 0);
+ PrivateExtractIconsA(sSourceFile, dwSourceIndex, 16, 16, &hiconSmall, NULL, 1, 0);
+ }
if ( !hiconLarge || !hiconSmall)
{
@@ -200,7 +214,7 @@ INT SIC_GetIconIndex (LPCSTR sSourceFile
* SIC_GetIcon [internal]
*
* NOTES
- * retrieves the specified icon from the iconcache. if not found tries to load the icon
+ * retrieves the specified icon from the iconcache.
*/
static HICON WINE_UNUSED SIC_GetIcon (LPCSTR sSourceFile, INT dwSourceIndex, BOOL bSmallIcon )
{ INT index;
@@ -372,8 +386,12 @@ int WINAPI SHMapPIDLToSystemImageListInd
pdump(pidl);
if (pIndex)
- PidlToSicIndex ( sh, pidl, 1, 0, pIndex);
- PidlToSicIndex ( sh, pidl, 0, 0, &Index);
+ if (!PidlToSicIndex ( sh, pidl, 1, 0, pIndex))
+ *pIndex = -1;
+
+ if (!PidlToSicIndex ( sh, pidl, 0, 0, &Index))
+ return -1;
+
return Index;
}
@@ -422,6 +440,19 @@ UINT WINAPI ExtractIconExAW(LPCVOID lpsz
*/
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON * phiconLarge, HICON * phiconSmall, UINT nIcons)
{
+ /* get entry point of undocumented function PrivateExtractIconExW() in user32 */
+#if defined (__MINGW32__) || defined(_MSC_VER)
+ static UINT (WINAPI*PrivateExtractIconExW)(LPCWSTR,int,HICON*,HICON*,UINT) = NULL;
+
+ if (!PrivateExtractIconExW) {
+ HMODULE hUser32 = GetModuleHandleA("user32");
+ PrivateExtractIconExW = (UINT(WINAPI*)(LPCWSTR,int,HICON*,HICON*,UINT)) GetProcAddress(hUser32, "PrivateExtractIconExW");
+
+ if (!PrivateExtractIconExW)
+ return 0;
+ }
+#endif
+
TRACE("%s %i %p %p %i\n", debugstr_w(lpszFile), nIconIndex, phiconLarge, phiconSmall, nIcons);
return PrivateExtractIconExW(lpszFile, nIconIndex, phiconLarge, phiconSmall, nIcons);
More information about the wine-patches
mailing list