shell32: Simplify imagelist handling.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3a1b289d66
commit
b8bf0c2628
|
@ -429,7 +429,6 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
|||
HRESULT hr = S_OK;
|
||||
BOOL IconNotYetLoaded=TRUE;
|
||||
UINT uGilFlags = 0;
|
||||
HIMAGELIST big_icons, small_icons;
|
||||
|
||||
TRACE("%s fattr=0x%x sfi=%p(attr=0x%08x) size=0x%x flags=0x%x\n",
|
||||
(flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes,
|
||||
|
@ -581,9 +580,6 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
|||
}
|
||||
|
||||
/* ### icons ###*/
|
||||
|
||||
Shell_GetImageLists( &big_icons, &small_icons );
|
||||
|
||||
if (flags & SHGFI_OPENICON)
|
||||
uGilFlags |= GIL_OPENICON;
|
||||
|
||||
|
@ -666,6 +662,9 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
|||
/* get icon index (or load icon)*/
|
||||
if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX)))
|
||||
{
|
||||
IImageList *icon_list;
|
||||
SHGetImageList( (flags & SHGFI_SMALLICON) ? SHIL_SMALL : SHIL_LARGE, &IID_IImageList, (void **)&icon_list );
|
||||
|
||||
if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
|
||||
{
|
||||
WCHAR sTemp [MAX_PATH];
|
||||
|
@ -727,21 +726,14 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
|||
}
|
||||
if (ret && (flags & SHGFI_SYSICONINDEX))
|
||||
{
|
||||
if (flags & SHGFI_SMALLICON)
|
||||
ret = (DWORD_PTR)small_icons;
|
||||
else
|
||||
ret = (DWORD_PTR)big_icons;
|
||||
IImageList_AddRef((IImageList*)ret);
|
||||
IImageList_AddRef( icon_list );
|
||||
ret = (DWORD_PTR)icon_list;
|
||||
}
|
||||
}
|
||||
|
||||
/* icon handle */
|
||||
if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
|
||||
{
|
||||
if (flags & SHGFI_SMALLICON)
|
||||
psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
|
||||
else
|
||||
psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
|
||||
if (ret && (flags & SHGFI_ICON))
|
||||
{
|
||||
hr = IImageList_GetIcon( icon_list, psfi->iIcon, ILD_NORMAL, &psfi->hIcon );
|
||||
}
|
||||
IImageList_Release( icon_list );
|
||||
}
|
||||
|
||||
if (flags & ~SHGFI_KNOWN_FLAGS)
|
||||
|
|
Loading…
Reference in New Issue