Skip to content

Commit

Permalink
[SHELL32] - Initialize the shell icon cache only when needed or when …
Browse files Browse the repository at this point in the history
…FileIconInit is called (and not in the DllMain of shell32)

svn path=/trunk/; revision=73436
  • Loading branch information
yagoulas committed Dec 7, 2016
1 parent 0b5c61d commit af810e8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
23 changes: 18 additions & 5 deletions reactos/dll/win32/shell32/iconcache.cpp
Expand Up @@ -453,6 +453,9 @@ INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags )
sice.dwSourceIndex = dwSourceIndex;
sice.dwFlags = dwFlags;

if (!sic_hdpa)
SIC_Initialize();

EnterCriticalSection(&SHELL32_SicCS);

if (NULL != DPA_GetPtr (sic_hdpa, 0))
Expand Down Expand Up @@ -687,6 +690,9 @@ static int SIC_LoadOverlayIcon(int icon_idx)
RegCloseKey(hKeyShellIcons);
}

if (!sic_hdpa)
SIC_Initialize();

return SIC_LoadIcon(iconPath, iconIdx, 0);
}

Expand All @@ -698,13 +704,17 @@ static int SIC_LoadOverlayIcon(int icon_idx)
*
*/
BOOL WINAPI Shell_GetImageLists(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList)
{ TRACE("(%p,%p)\n",lpBigList,lpSmallList);
{
TRACE("(%p,%p)\n",lpBigList,lpSmallList);

if (!sic_hdpa)
SIC_Initialize();

if (lpBigList)
{ *lpBigList = ShellBigIconList;
}
*lpBigList = ShellBigIconList;

if (lpSmallList)
{ *lpSmallList = ShellSmallIconList;
}
*lpSmallList = ShellSmallIconList;

return TRUE;
}
Expand Down Expand Up @@ -735,6 +745,9 @@ BOOL PidlToSicIndex (

TRACE("sf=%p pidl=%p %s\n", sh, pidl, bBigIcon?"Big":"Small");

if (!sic_hdpa)
SIC_Initialize();

if (SUCCEEDED (sh->GetUIObjectOf(0, 1, &pidl, IID_NULL_PPV_ARG(IExtractIconW, &ei))))
{
if (SUCCEEDED(ei->GetIconLocation(uFlags, szIconFile, MAX_PATH, &iSourceIndex, &dwFlags)))
Expand Down
1 change: 0 additions & 1 deletion reactos/dll/win32/shell32/shell32.cpp
Expand Up @@ -308,7 +308,6 @@ STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID fImpLoad)
InitCommonControlsEx(&InitCtrls);

/* Bad idea, initialization in DllMain! */
SIC_Initialize();
InitChangeNotifications();
}
else if (dwReason == DLL_PROCESS_DETACH)
Expand Down
4 changes: 2 additions & 2 deletions reactos/dll/win32/shell32/wine/shellord.c
Expand Up @@ -1292,8 +1292,8 @@ BOOL WINAPI WriteCabinetState(CABINETSTATE *cs)
*
*/
BOOL WINAPI FileIconInit(BOOL bFullInit)
{ FIXME("(%s)\n", bFullInit ? "true" : "false");
return FALSE;
{
return SIC_Initialize();
}

/*************************************************************************
Expand Down

0 comments on commit af810e8

Please sign in to comment.