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:
Huw Davies 2017-05-02 16:12:35 +01:00 committed by Alexandre Julliard
parent 3a1b289d66
commit b8bf0c2628
1 changed files with 10 additions and 18 deletions

View File

@ -429,7 +429,6 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
HRESULT hr = S_OK; HRESULT hr = S_OK;
BOOL IconNotYetLoaded=TRUE; BOOL IconNotYetLoaded=TRUE;
UINT uGilFlags = 0; 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", 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, (flags & SHGFI_PIDL)? "pidl" : debugstr_w(path), dwFileAttributes,
@ -581,9 +580,6 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
} }
/* ### icons ###*/ /* ### icons ###*/
Shell_GetImageLists( &big_icons, &small_icons );
if (flags & SHGFI_OPENICON) if (flags & SHGFI_OPENICON)
uGilFlags |= GIL_OPENICON; uGilFlags |= GIL_OPENICON;
@ -666,6 +662,9 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
/* get icon index (or load icon)*/ /* get icon index (or load icon)*/
if (SUCCEEDED(hr) && (flags & (SHGFI_ICON | SHGFI_SYSICONINDEX))) 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)) if (flags & SHGFI_USEFILEATTRIBUTES && !(flags & SHGFI_PIDL))
{ {
WCHAR sTemp [MAX_PATH]; WCHAR sTemp [MAX_PATH];
@ -727,21 +726,14 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
} }
if (ret && (flags & SHGFI_SYSICONINDEX)) if (ret && (flags & SHGFI_SYSICONINDEX))
{ {
if (flags & SHGFI_SMALLICON) IImageList_AddRef( icon_list );
ret = (DWORD_PTR)small_icons; ret = (DWORD_PTR)icon_list;
else
ret = (DWORD_PTR)big_icons;
IImageList_AddRef((IImageList*)ret);
} }
} if (ret && (flags & SHGFI_ICON))
{
/* icon handle */ hr = IImageList_GetIcon( icon_list, psfi->iIcon, ILD_NORMAL, &psfi->hIcon );
if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded) }
{ IImageList_Release( icon_list );
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 (flags & ~SHGFI_KNOWN_FLAGS) if (flags & ~SHGFI_KNOWN_FLAGS)