shell32: fix folder icon index when read from registry

Martin Fuchs martin-fuchs at gmx.net
Sat Dec 31 14:31:25 CST 2005


Changelog:
fix folder icon index when read from registry


Index: folders.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/folders.c,v
retrieving revision 1.66
diff -u -p -d -r1.66 folders.c
--- folders.c	26 Aug 2005 10:05:35 -0000	1.66
+++ folders.c	31 Dec 2005 20:29:30 -0000
@@ -166,7 +166,7 @@ static HRESULT getIconLocationForFolder(
  LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags)
 {
     IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
-    DWORD dwNr;
+    DWORD dwNr;	/*TODO: change to int type */
     WCHAR wszPath[MAX_PATH];
     WCHAR wszCLSIDValue[CHARS_IN_GUID];
     static const WCHAR shellClassInfo[] = { '.','S','h','e','l','l','C','l','a','s','s','I','n','f','o',0 };
@@ -202,9 +202,13 @@ static HRESULT getIconLocationForFolder(
         if (!HCR_GetDefaultIconW(folder, szIconFile, cchMax, &dwNr))
         {
             lstrcpynW(szIconFile, swShell32Name, cchMax);
-            dwNr = IDI_SHELL_FOLDER;
+            dwNr = (DWORD)-IDI_SHELL_FOLDER;
         }
-        *piIndex = -((uFlags & GIL_OPENICON) ? dwNr + 1 : dwNr);
+
+        if (uFlags & GIL_OPENICON)
+            *piIndex = (int)dwNr<0? (int)dwNr-1: dwNr+1;
+        else
+            *piIndex = dwNr;
     }
     return S_OK;
 }




More information about the wine-patches mailing list