-fix crash in shell32 caused by clamwin installer (patch by w3seek)

svn path=/trunk/; revision=27887
This commit is contained in:
Christoph von Wittich 2007-07-26 21:43:22 +00:00
parent da22f48dfd
commit ea206e8a12

View file

@ -508,6 +508,8 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
/* get the iconlocation */
if (SUCCEEDED(hr) && (flags & SHGFI_ICONLOCATION ))
{
if (!(flags & SHGFI_USEFILEATTRIBUTES))
{
UINT uDummy,uFlags;
@ -528,6 +530,40 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
IExtractIconA_Release(pei);
}
}
else
{
if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
strcpyW(psfi->szDisplayName, swShell32Name);
psfi->iIcon = SIC_GetIconIndex(swShell32Name, -IDI_SHELL_FOLDER, 0);
}
else
{
WCHAR sTemp [MAX_PATH];
WCHAR * szExt;
DWORD dwNr=0;
static const WCHAR p1W[] = {'%','1',0};
lstrcpynW(sTemp, szFullPath, MAX_PATH);
psfi->iIcon = 0;
szExt = (LPWSTR) PathFindExtensionW(sTemp);
if ( szExt &&
HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &dwNr))
{
if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
strcpyW(psfi->szDisplayName, szFullPath);
else
strcpyW(psfi->szDisplayName, sTemp);
psfi->iIcon = SIC_GetIconIndex(psfi->szDisplayName, dwNr, 0);
if (psfi->iIcon == -1)
psfi->iIcon = 0;
}
}
}
}
/* get icon index (or load icon)*/
if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))