diff --git a/dll/win32/shell32/folders/CFSFolder.cpp b/dll/win32/shell32/folders/CFSFolder.cpp index 95ba3b95f6c..93cacdd1e2f 100644 --- a/dll/win32/shell32/folders/CFSFolder.cpp +++ b/dll/win32/shell32/folders/CFSFolder.cpp @@ -307,7 +307,7 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE ILGetDisplayNameExW(psf, pidl, wTemp, ILGDN_FORPARSING); icon_idx = 0; - INT ret = ExtractIconExW(wTemp, -1, NULL, NULL, 0); + INT ret = PrivateExtractIconsW(wTemp, 0, 0, 0, NULL, NULL, 0, 0); if (ret <= 0) { StringCbCopyW(wTemp, sizeof(wTemp), swShell32Name); diff --git a/win32ss/user/user32/misc/exticon.c b/win32ss/user/user32/misc/exticon.c index 33f8f19b15f..00e9357987b 100644 --- a/win32ss/user/user32/misc/exticon.c +++ b/win32ss/user/user32/misc/exticon.c @@ -283,7 +283,12 @@ static UINT ICO_ExtractIconExW( UINT cxDesired, UINT cyDesired, UINT *pIconId, +#ifdef __REACTOS__ + UINT flags, + BOOL fUser32) +#else UINT flags) +#endif { UINT ret = 0; UINT cx1, cx2, cy1, cy2; @@ -576,6 +581,16 @@ static UINT ICO_ExtractIconExW( #ifdef __REACTOS__ icon = CreateIconFromResourceEx(imageData, cbTotal, sig == 1, 0x00030000, cx[index], cy[index], flags); + + /* This function is called from two difference code paths. + * One is from Shell32 using the ExtractIconEx function. + * The other is from User32 using PrivateExtractIcons. + * Based on W2K3SP2 testing, the count of icons returned + * is zero (0) for PNG ones using ExtractIconEx and + * one (1) for PNG icons using PrivateExtractIcons. + * This handles the difference for these .ico files.*/ + if (fUser32 && (sig == 1)) + iconCount = 1; #else icon = CreateIconFromResourceEx(imageData, entry->icHeader.biSizeImage, sig == 1, 0x00030000, cx[index], cy[index], flags); #endif @@ -773,7 +788,12 @@ UINT WINAPI PrivateExtractIconsW ( { WARN("Uneven number %d of icons requested for small and large icons!\n", nIcons); } - return ICO_ExtractIconExW(lpwstrFile, phicon, nIndex, nIcons, sizeX, sizeY, pIconId, flags); +#ifdef __REACTOS__ + return ICO_ExtractIconExW(lpwstrFile, phicon, nIndex, nIcons, sizeX, sizeY, + pIconId, flags, TRUE); +#else + return ICO_ExtractIconExW(lpwstrFile, phicon, nIndex, nIcons, sizeX, sizeY, pIconId, flags); +#endif } /*********************************************************************** @@ -825,7 +845,12 @@ UINT WINAPI PrivateExtractIconExW ( if (nIndex == -1) /* get the number of icons */ - return ICO_ExtractIconExW(lpwstrFile, NULL, 0, 0, 0, 0, NULL, LR_DEFAULTCOLOR); +#ifdef __REACTOS__ + return ICO_ExtractIconExW(lpwstrFile, NULL, 0, 0, 0, 0, NULL, + LR_DEFAULTCOLOR, FALSE); +#else + return ICO_ExtractIconExW(lpwstrFile, NULL, 0, 0, 0, 0, NULL, LR_DEFAULTCOLOR); +#endif if (nIcons == 1 && phIconSmall && phIconLarge) { @@ -835,8 +860,15 @@ UINT WINAPI PrivateExtractIconExW ( cxsmicon = GetSystemMetrics(SM_CXSMICON); cysmicon = GetSystemMetrics(SM_CYSMICON); +#ifdef __REACTOS__ + ret = ICO_ExtractIconExW(lpwstrFile, hIcon, nIndex, 2, + cxicon | (cxsmicon<<16), + cyicon | (cysmicon<<16), NULL, + LR_DEFAULTCOLOR, FALSE); +#else ret = ICO_ExtractIconExW(lpwstrFile, hIcon, nIndex, 2, cxicon | (cxsmicon<<16), cyicon | (cysmicon<<16), NULL, LR_DEFAULTCOLOR); +#endif *phIconLarge = hIcon[0]; *phIconSmall = hIcon[1]; return ret; @@ -847,16 +879,26 @@ UINT WINAPI PrivateExtractIconExW ( /* extract n small icons */ cxsmicon = GetSystemMetrics(SM_CXSMICON); cysmicon = GetSystemMetrics(SM_CYSMICON); - ret = ICO_ExtractIconExW(lpwstrFile, phIconSmall, nIndex, nIcons, cxsmicon, - cysmicon, NULL, LR_DEFAULTCOLOR); +#ifdef __REACTOS__ + ret = ICO_ExtractIconExW(lpwstrFile, phIconSmall, nIndex, nIcons, cxsmicon, + cysmicon, NULL, LR_DEFAULTCOLOR, FALSE); +#else + ret = ICO_ExtractIconExW(lpwstrFile, phIconSmall, nIndex, nIcons, cxsmicon, + cysmicon, NULL, LR_DEFAULTCOLOR); +#endif } if (phIconLarge) { /* extract n large icons */ cxicon = GetSystemMetrics(SM_CXICON); cyicon = GetSystemMetrics(SM_CYICON); +#ifdef __REACTOS__ ret = ICO_ExtractIconExW(lpwstrFile, phIconLarge, nIndex, nIcons, cxicon, - cyicon, NULL, LR_DEFAULTCOLOR); + cyicon, NULL, LR_DEFAULTCOLOR, FALSE); +#else + ret = ICO_ExtractIconExW(lpwstrFile, phIconLarge, nIndex, nIcons, cxicon, + cyicon, NULL, LR_DEFAULTCOLOR); +#endif } return ret; }