[SHELL32] Shell extension support for files.
[reactos.git] / reactos / dll / win32 / shell32 / iconcache.cpp
index 2934304..400f75c 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,9 +745,12 @@ 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)))
+      if (SUCCEEDED(ei->GetIconLocation(uFlags &~ GIL_FORSHORTCUT, szIconFile, MAX_PATH, &iSourceIndex, &dwFlags)))
       {
         *pIndex = SIC_GetIconIndex(szIconFile, iSourceIndex, uFlags);
         ret = TRUE;