Commit 3ae80eb2 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

Fixed the behavior for SHGetFileInfo when the SHGFI_USEFILEATTRIBUTES

flag is set. Corrects the given type and icon.
parent ddc3317b
......@@ -27,6 +27,10 @@ BOOL HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len, BOOL
TRACE("%s %p\n",szExtension, szFileType );
/* added because we do not want to have double dots */
if (szExtension[0]=='.')
bPrependDot=0;
if (bPrependDot)
strcpy(szTemp, ".");
......
......@@ -201,6 +201,7 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
IExtractIconA * pei = NULL;
LPITEMIDLIST pidlLast = NULL, pidl = NULL;
HRESULT hr = S_OK;
BOOL IconNotYetLoaded=TRUE;
TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
(flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
......@@ -323,7 +324,19 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
/* get the type name */
if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
{
_ILGetFileType(pidlLast, psfi->szTypeName, 80);
if (!flags & SHGFI_USEFILEATTRIBUTES)
_ILGetFileType(pidlLast, psfi->szTypeName, 80);
else
{
char sTemp[64];
strcpy(sTemp,PathFindExtensionA(path));
if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE)
&& HCR_MapTypeToValue(sTemp, psfi->szTypeName, 80, FALSE )))
{
lstrcpynA (psfi->szTypeName, sTemp, 80 - 6);
strcat (psfi->szTypeName, "-file");
}
}
}
/* ### icons ###*/
......@@ -359,6 +372,7 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
/* get icon index (or load icon)*/
if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
{
if (flags & SHGFI_USEFILEATTRIBUTES)
{
char sTemp [MAX_PATH];
......@@ -374,10 +388,16 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
{
strcpy(sTemp, path);
}
/* FIXME: if sTemp contains a valid filename, get the icon
from there, index is in dwNr
*/
psfi->iIcon = 2;
IconNotYetLoaded=FALSE;
psfi->iIcon = 0;
if (SHGFI_LARGEICON)
PrivateExtractIconsA(sTemp,dwNr,GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
&psfi->hIcon,0,1,0);
else
PrivateExtractIconsA(sTemp,dwNr,GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
&psfi->hIcon,0,1,0);
}
else /* default icon */
{
......@@ -399,7 +419,7 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
}
/* icon handle */
if (SUCCEEDED(hr) && (flags & SHGFI_ICON))
if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
psfi->hIcon = ImageList_GetIcon((flags & SHGFI_LARGEICON) ? ShellBigIconList:ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
if (flags & (SHGFI_UNKNOWN1 | SHGFI_UNKNOWN2 | SHGFI_UNKNOWN3))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment