From e330a128d54613d2f7322cc3da2c8a5fea866992 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 2 Jan 2014 11:56:11 +0100 Subject: [PATCH] shell32: Use Shell_GetImageLists to retrieve image lists instead of using a global variable. --- dlls/shell32/folders.c | 7 ++++--- dlls/shell32/iconcache.c | 2 ++ dlls/shell32/shell32_main.c | 14 ++++++++------ dlls/shell32/shell32_main.h | 2 -- dlls/shell32/shlview.c | 6 ++++-- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c index 48486444c15..34e51426487 100644 --- a/dlls/shell32/folders.c +++ b/dlls/shell32/folders.c @@ -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; } diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c index 3d54508bfca..b29490896d7 100644 --- a/dlls/shell32/iconcache.c +++ b/dlls/shell32/iconcache.c @@ -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 = diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 9ac715c4015..091c6e1fc47 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -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, @@ -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; @@ -707,9 +711,9 @@ 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; } } @@ -717,9 +721,9 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, 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) @@ -1248,8 +1252,6 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi) * */ HINSTANCE shell32_hInstance = 0; -HIMAGELIST ShellSmallIconList = 0; -HIMAGELIST ShellBigIconList = 0; /************************************************************************* diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index 776e3dfcebf..e7765eb21d8 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -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 diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index c937ccee369..85209860b60 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -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]; @@ -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;