shell32: Use Shell_GetImageLists to retrieve image lists instead of using a global variable.

This commit is contained in:
Alexandre Julliard 2014-01-02 11:56:11 +01:00
parent 5f4ccc016f
commit e330a128d5
5 changed files with 18 additions and 13 deletions

View File

@ -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;
}

View File

@ -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 =

View File

@ -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;
/*************************************************************************

View File

@ -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

View File

@ -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;