[SHELL32] - Initialize the shell icon cache only when needed or when FileIconInit...
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 7 Dec 2016 00:10:43 +0000 (00:10 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Wed, 7 Dec 2016 00:10:43 +0000 (00:10 +0000)
svn path=/trunk/; revision=73436

reactos/dll/win32/shell32/iconcache.cpp
reactos/dll/win32/shell32/shell32.cpp
reactos/dll/win32/shell32/wine/shellord.c

index 2934304..9190500 100644 (file)
@@ -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))
@@ -687,6 +690,9 @@ static int SIC_LoadOverlayIcon(int icon_idx)
         RegCloseKey(hKeyShellIcons);
     }
 
+    if (!sic_hdpa)
+        SIC_Initialize();
+
     return SIC_LoadIcon(iconPath, iconIdx, 0);
 }
 
@@ -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;
 }
@@ -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)))
index 0b1e444..2ef621a 100644 (file)
@@ -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)
index 90814c1..df2c520 100644 (file)
@@ -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();
 }
 
 /*************************************************************************