*
* Copyright 1998 Marcus Meissner
* Copyright 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
+ * Copyright 2017 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
{
psfi->szDisplayName[0] = '\0';
psfi->szTypeName[0] = '\0';
- psfi->iIcon = 0;
+ psfi->hIcon = NULL;
}
if (!(flags & SHGFI_PIDL))
lstrcpynW(szFullPath, path, MAX_PATH);
}
}
+ else
+ {
+ SHGetPathFromIDListW((LPITEMIDLIST)path, szFullPath);
+ }
if (flags & SHGFI_EXETYPE)
{
- if (flags != SHGFI_EXETYPE)
- return 0;
- return shgfi_get_exe_type(szFullPath);
+ if (!(flags & SHGFI_SYSICONINDEX))
+ {
+ if (flags & SHGFI_USEFILEATTRIBUTES)
+ {
+ return TRUE;
+ }
+ else if (GetFileAttributesW(szFullPath) != INVALID_FILE_ATTRIBUTES)
+ {
+ return shgfi_get_exe_type(szFullPath);
+ }
+ }
}
/*
(LPCITEMIDLIST*)&pidlLast );
if (SUCCEEDED(hr))
pidlLast = ILClone(pidlLast);
+ else
+ hr = S_OK;
ILFree(pidl);
}
else
psfi->dwAttributes = 0xffffffff;
}
if (psfParent)
- IShellFolder_GetAttributesOf( psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
- &(psfi->dwAttributes) );
+ {
+ IShellFolder_GetAttributesOf(psfParent, 1, (LPCITEMIDLIST*)&pidlLast,
+ &(psfi->dwAttributes));
+ }
+ }
+
+ if (flags & SHGFI_USEFILEATTRIBUTES)
+ {
+ if (flags & SHGFI_ICON)
+ {
+ psfi->dwAttributes = 0;
+ }
}
/* get the displayname */
{
lstrcpyW (psfi->szDisplayName, PathFindFileNameW(szFullPath));
}
- else
+ else if (psfParent)
{
STRRET str;
hr = IShellFolder_GetDisplayNameOf( psfParent, pidlLast,
ret = FALSE;
}
}
- else
+ else if (psfParent)
{
hr = IShellFolder_GetUIObjectOf(psfParent, 0, 1,
(LPCITEMIDLIST*)&pidlLast, &IID_IExtractIconW,
}
}
}
- else
+ else if (psfParent)
{
if (!(PidlToSicIndex(psfParent, pidlLast, !(flags & SHGFI_SMALLICON),
uGilFlags, &(psfi->iIcon))))
pathW = temppath;
}
- if (psfi && (flags & SHGFI_ATTR_SPECIFIED))
- temppsfi.dwAttributes=psfi->dwAttributes;
+ if (psfi)
+ {
+ temppsfi.hIcon = psfi->hIcon;
+ temppsfi.iIcon = psfi->iIcon;
+ temppsfi.dwAttributes = psfi->dwAttributes;
- if (psfi == NULL)
- ret = SHGetFileInfoW(pathW, dwFileAttributes, NULL, 0, flags);
- else
ret = SHGetFileInfoW(pathW, dwFileAttributes, &temppsfi, sizeof(temppsfi), flags);
+ psfi->hIcon = temppsfi.hIcon;
+ psfi->iIcon = temppsfi.iIcon;
+ psfi->dwAttributes = temppsfi.dwAttributes;
- if (psfi)
- {
- if(flags & SHGFI_ICON)
- psfi->hIcon=temppsfi.hIcon;
- if(flags & (SHGFI_SYSICONINDEX|SHGFI_ICON|SHGFI_ICONLOCATION))
- psfi->iIcon=temppsfi.iIcon;
- if(flags & SHGFI_ATTRIBUTES)
- psfi->dwAttributes=temppsfi.dwAttributes;
- if(flags & (SHGFI_DISPLAYNAME|SHGFI_ICONLOCATION))
- {
- WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1,
- psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
- }
- if(flags & SHGFI_TYPENAME)
- {
- WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
- psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
- }
+ WideCharToMultiByte(CP_ACP, 0, temppsfi.szDisplayName, -1,
+ psfi->szDisplayName, sizeof(psfi->szDisplayName), NULL, NULL);
+
+ WideCharToMultiByte(CP_ACP, 0, temppsfi.szTypeName, -1,
+ psfi->szTypeName, sizeof(psfi->szTypeName), NULL, NULL);
}
+ else
+ ret = SHGetFileInfoW(pathW, dwFileAttributes, NULL, 0, flags);
HeapFree(GetProcessHeap(), 0, temppath);