Skip to content

Commit

Permalink
shell32: Use Shell_GetImageLists to retrieve image lists instead of u…
Browse files Browse the repository at this point in the history
…sing a global variable.
  • Loading branch information
julliard committed Jan 2, 2014
1 parent 5f4ccc0 commit e330a12
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
7 changes: 4 additions & 3 deletions dlls/shell32/folders.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,17 +354,18 @@ static HRESULT WINAPI IExtractIconW_fnExtract(IExtractIconW * iface, LPCWSTR psz
{
IExtractIconWImpl *This = impl_from_IExtractIconW(iface);
int index;
HIMAGELIST big_icons, small_icons;

FIXME("(%p) (file=%s index=%d %p %p size=%08x) semi-stub\n", This, debugstr_w(pszFile),
(signed)nIconIndex, phiconLarge, phiconSmall, nIconSize);

index = SIC_GetIconIndex(pszFile, nIconIndex, 0);

Shell_GetImageLists( &big_icons, &small_icons );
if (phiconLarge)
*phiconLarge = ImageList_GetIcon(ShellBigIconList, index, ILD_TRANSPARENT);
*phiconLarge = ImageList_GetIcon(big_icons, index, ILD_TRANSPARENT);

if (phiconSmall)
*phiconSmall = ImageList_GetIcon(ShellSmallIconList, index, ILD_TRANSPARENT);
*phiconSmall = ImageList_GetIcon(small_icons, index, ILD_TRANSPARENT);

return S_OK;
}
Expand Down
2 changes: 2 additions & 0 deletions dlls/shell32/iconcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ typedef struct

static HDPA sic_hdpa;
static INIT_ONCE sic_init_once = INIT_ONCE_STATIC_INIT;
static HIMAGELIST ShellSmallIconList;
static HIMAGELIST ShellBigIconList;

static CRITICAL_SECTION SHELL32_SicCS;
static CRITICAL_SECTION_DEBUG critsect_debug =
Expand Down
14 changes: 8 additions & 6 deletions dlls/shell32/shell32_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ 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,
Expand Down Expand Up @@ -563,6 +564,9 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
}

/* ### icons ###*/

Shell_GetImageLists( &big_icons, &small_icons );

if (flags & SHGFI_OPENICON)
uGilFlags |= GIL_OPENICON;

Expand Down Expand Up @@ -707,19 +711,19 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
if (ret && (flags & SHGFI_SYSICONINDEX))
{
if (flags & SHGFI_SMALLICON)
ret = (DWORD_PTR) ShellSmallIconList;
ret = (DWORD_PTR)small_icons;
else
ret = (DWORD_PTR) ShellBigIconList;
ret = (DWORD_PTR)big_icons;
}
}

/* icon handle */
if (SUCCEEDED(hr) && (flags & SHGFI_ICON) && IconNotYetLoaded)
{
if (flags & SHGFI_SMALLICON)
psfi->hIcon = ImageList_GetIcon( ShellSmallIconList, psfi->iIcon, ILD_NORMAL);
psfi->hIcon = ImageList_GetIcon( small_icons, psfi->iIcon, ILD_NORMAL);
else
psfi->hIcon = ImageList_GetIcon( ShellBigIconList, psfi->iIcon, ILD_NORMAL);
psfi->hIcon = ImageList_GetIcon( big_icons, psfi->iIcon, ILD_NORMAL);
}

if (flags & ~SHGFI_KNOWN_FLAGS)
Expand Down Expand Up @@ -1248,8 +1252,6 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
*
*/
HINSTANCE shell32_hInstance = 0;
HIMAGELIST ShellSmallIconList = 0;
HIMAGELIST ShellBigIconList = 0;


/*************************************************************************
Expand Down
2 changes: 0 additions & 2 deletions dlls/shell32/shell32_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@
*/
extern HMODULE huser32 DECLSPEC_HIDDEN;
extern HINSTANCE shell32_hInstance DECLSPEC_HIDDEN;
extern HIMAGELIST ShellSmallIconList DECLSPEC_HIDDEN;
extern HIMAGELIST ShellBigIconList DECLSPEC_HIDDEN;

/* Iconcache */
#define INVALID_INDEX -1
Expand Down
6 changes: 4 additions & 2 deletions dlls/shell32/shlview.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
static void ShellView_InitList(IShellViewImpl *This)
{
IShellDetails *details = NULL;
HIMAGELIST big_icons, small_icons;
LVCOLUMNW lvColumn;
SHELLDETAILS sd;
WCHAR nameW[50];
Expand All @@ -414,9 +415,10 @@ static void ShellView_InitList(IShellViewImpl *This)

TRACE("(%p)\n", This);

Shell_GetImageLists( &big_icons, &small_icons );
SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)small_icons);
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)big_icons);

lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
lvColumn.pszText = nameW;
Expand Down

0 comments on commit e330a12

Please sign in to comment.