shell: icons

Huw D M Davies h.davies1 at physics.ox.ac.uk
Wed Apr 6 08:56:53 CDT 2005


        Huw Davies <huw at codeweavers.com>
        Fix the icon resource ids (most were off by one).
        Fix IExtractIcon_{GetIconLocation,Extract} to use -ve icon
        resource ids and fix bugs relating to confusion between
        resource ids and the system imagelist indicies.
        Extend the system imagelist initialization hack to load
        both +ve and -ve resource ids.
        Add a printer icon (that'll be used by an upcoming printer
        folder patch).
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/shell32/.cvsignore
===================================================================
RCS file: /home/wine/wine/dlls/shell32/.cvsignore,v
retrieving revision 1.20
diff -u -p -r1.20 .cvsignore
--- dlls/shell32/.cvsignore	19 Nov 2004 18:28:05 -0000	1.20
+++ dlls/shell32/.cvsignore	6 Apr 2005 13:39:48 -0000
@@ -10,6 +10,7 @@ folder_open.ico
 mycomputer.ico
 netdrive.ico
 netdrive2.ico
+printer.ico
 ramdisk.ico
 shell.spec.c
 shell32.dll.dbg.c
Index: dlls/shell32/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/shell32/Makefile.in,v
retrieving revision 1.88
diff -u -p -r1.88 Makefile.in
--- dlls/shell32/Makefile.in	9 Mar 2005 16:41:17 -0000	1.88
+++ dlls/shell32/Makefile.in	6 Apr 2005 13:39:48 -0000
@@ -62,6 +62,7 @@ RC_BINARIES = \
 	mycomputer.ico \
 	netdrive.ico \
 	netdrive2.ico \
+	printer.ico \
 	ramdisk.ico
 
 C_SRCS16  = shell.c
Index: dlls/shell32/classes.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/classes.c,v
retrieving revision 1.36
diff -u -p -r1.36 classes.c
--- dlls/shell32/classes.c	3 Mar 2005 13:52:06 -0000	1.36
+++ dlls/shell32/classes.c	6 Apr 2005 13:39:48 -0000
@@ -223,7 +223,12 @@ BOOL HCR_GetDefaultIconW(LPCWSTR szClass
 	  ret = HCR_RegGetDefaultIconW(hkey, szDest, len, dwNr);
 	  RegCloseKey(hkey);
 	}
-	TRACE("-- %s %li\n", debugstr_w(szDest), *dwNr );
+
+        if(ret)
+            TRACE("-- %s %li\n", debugstr_w(szDest), *dwNr );
+        else
+            TRACE("-- not found\n");
+
 	return ret;
 }
 
Index: dlls/shell32/folders.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/folders.c,v
retrieving revision 1.57
diff -u -p -r1.57 folders.c
--- dlls/shell32/folders.c	21 Mar 2005 11:25:13 -0000	1.57
+++ dlls/shell32/folders.c	6 Apr 2005 13:39:48 -0000
@@ -40,6 +40,7 @@
 #include "pidl.h"
 #include "shell32_main.h"
 #include "shfldr.h"
+#include "shresdef.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(shell);
 
@@ -196,9 +197,9 @@ static HRESULT getIconLocationForFolder(
         if (!HCR_GetDefaultIconW(folder, szIconFile, cchMax, &dwNr))
         {
             lstrcpynW(szIconFile, swShell32Name, cchMax);
-            dwNr = 3;
+            dwNr = IDI_SHELL_FOLDER;
         }
-        *piIndex = (uFlags & GIL_OPENICON) ? dwNr + 1 : dwNr;
+        *piIndex = -((uFlags & GIL_OPENICON) ? dwNr + 1 : dwNr);
     }
     return S_OK;
 }
@@ -233,7 +234,7 @@ static HRESULT WINAPI IExtractIconW_fnGe
 	if (_ILIsDesktop(pSimplePidl))
 	{
 	  lstrcpynW(szIconFile, swShell32Name, cchMax);
-	  *piIndex = 34;
+	  *piIndex = -IDI_SHELL_DESKTOP;
 	}
 
 	/* my computer and other shell extensions */
@@ -257,7 +258,7 @@ static HRESULT WINAPI IExtractIconW_fnGe
 	  else
 	  {
 	    lstrcpynW(szIconFile, swShell32Name, cchMax);
-	    *piIndex = 15;
+	    *piIndex = -IDI_SHELL_MYCOMPUTER;
 	  }
 	}
 
@@ -271,17 +272,17 @@ static HRESULT WINAPI IExtractIconW_fnGe
 	  {
 		switch(GetDriveTypeA(sTemp))
 		{
-		  case DRIVE_REMOVABLE:	  icon_idx =  5;	break;
-		  case DRIVE_CDROM:		  icon_idx = 11;	break;
-		  case DRIVE_REMOTE:	  icon_idx =  9;	break;
-		  case DRIVE_RAMDISK: 	  icon_idx = 12;	break;
+                  case DRIVE_REMOVABLE:   icon_idx = IDI_SHELL_FLOPPY;        break;
+                  case DRIVE_CDROM:       icon_idx = IDI_SHELL_CDROM;         break;
+                  case DRIVE_REMOTE:      icon_idx = IDI_SHELL_NETDRIVE;      break;
+                  case DRIVE_RAMDISK:     icon_idx = IDI_SHELL_RAMDISK;       break;
 		}
 	  }
 
 	  if (icon_idx != -1)
 	  {
 		lstrcpynW(szIconFile, swShell32Name, cchMax);
-		*piIndex = icon_idx;
+		*piIndex = -icon_idx;
 	  }
 	  else
 	  {
@@ -292,14 +293,14 @@ static HRESULT WINAPI IExtractIconW_fnGe
 		else
 		{
 		  lstrcpynW(szIconFile, swShell32Name, cchMax);
-		  *piIndex = 8;
+		  *piIndex = -IDI_SHELL_DRIVE;
 		}
 	  }
 	}
 	else if (_ILIsFolder (pSimplePidl))
 	{
-	  getIconLocationForFolder(iface, uFlags, szIconFile, cchMax, piIndex,
-	   pwFlags);
+            getIconLocationForFolder(iface, uFlags, szIconFile, cchMax, piIndex,
+                                     pwFlags);
 	}
 	else
 	{
@@ -370,14 +371,18 @@ static HRESULT WINAPI IExtractIconW_fnGe
 static HRESULT WINAPI IExtractIconW_fnExtract(IExtractIconW * iface, LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
 {
 	IExtractIconWImpl *This = (IExtractIconWImpl *)iface;
+        int index;
 
-	FIXME("(%p) (file=%p index=%u %p %p size=%u) semi-stub\n", This, debugstr_w(pszFile), nIconIndex, phiconLarge, phiconSmall, nIconSize);
+	FIXME("(%p) (file=%p index=%d %p %p size=%08x) semi-stub\n", This, debugstr_w(pszFile), (signed)nIconIndex,
+              phiconLarge, phiconSmall, nIconSize);
+
+        index = SIC_GetIconIndex(pszFile, nIconIndex);
 
 	if (phiconLarge)
-	  *phiconLarge = ImageList_GetIcon(ShellBigIconList, nIconIndex, ILD_TRANSPARENT);
+	  *phiconLarge = ImageList_GetIcon(ShellBigIconList, index, ILD_TRANSPARENT);
 
 	if (phiconSmall)
-	  *phiconSmall = ImageList_GetIcon(ShellSmallIconList, nIconIndex, ILD_TRANSPARENT);
+	  *phiconSmall = ImageList_GetIcon(ShellSmallIconList, index, ILD_TRANSPARENT);
 
 	return S_OK;
 }
Index: dlls/shell32/iconcache.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/iconcache.c,v
retrieving revision 1.86
diff -u -p -r1.86 iconcache.c
--- dlls/shell32/iconcache.c	3 Jan 2005 20:26:06 -0000	1.86
+++ dlls/shell32/iconcache.c	6 Apr 2005 13:39:48 -0000
@@ -243,7 +243,8 @@ BOOL SIC_Initialize(void)
 	    hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(1), IMAGE_ICON, cx_small, cy_small, LR_SHARED);
 	    hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(1), IMAGE_ICON, cx_large, cy_large, LR_SHARED);
 	  }
-         SIC_IconAppend (swShell32Name, index, hSm, hLg);
+         SIC_IconAppend (swShell32Name, index - 1, hSm, hLg);
+         SIC_IconAppend (swShell32Name, -index, hSm, hLg);
 	}
 
 	TRACE("hIconSmall=%p hIconBig=%p\n",ShellSmallIconList, ShellBigIconList);
Index: dlls/shell32/shell32_main.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32_main.c,v
retrieving revision 1.147
diff -u -p -r1.147 shell32_main.c
--- dlls/shell32/shell32_main.c	25 Feb 2005 14:07:57 -0000	1.147
+++ dlls/shell32/shell32_main.c	6 Apr 2005 13:39:48 -0000
@@ -44,6 +44,7 @@
 #include "pidl.h"
 #include "shell32_main.h"
 #include "version.h"
+#include "shresdef.h"
 
 #include "wine/debug.h"
 #include "wine/unicode.h"
@@ -501,7 +502,7 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path
             lstrcpynW(sTemp, szFullPath, MAX_PATH);
 
             if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
-                psfi->iIcon = 2;
+                psfi->iIcon = SIC_GetIconIndex(swShell32Name, -IDI_SHELL_FOLDER);
             else
             {
                 static const WCHAR p1W[] = {'%','1',0};
Index: dlls/shell32/shres.rc
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shres.rc,v
retrieving revision 1.36
diff -u -p -r1.36 shres.rc
--- dlls/shell32/shres.rc	27 Oct 2004 00:47:53 -0000	1.36
+++ dlls/shell32/shres.rc	6 Apr 2005 13:39:49 -0000
@@ -36,7 +36,7 @@ BEGIN
 END
 
 /* BINRES document.ico */
-1 ICON document.ico
+IDI_SHELL_DOCUMENT ICON document.ico
 /* {
  '00 00 01 00 04 00 10 10 10 00 01 00 04 00 28 01'
  '00 00 46 00 00 00 10 10 00 00 01 00 08 00 68 05'
@@ -340,7 +340,7 @@ END
 
 
 /* BINRES folder.ico */
-3 ICON folder.ico
+IDI_SHELL_FOLDER ICON folder.ico
 /* {
  '00 00 01 00 04 00 10 10 10 00 01 00 04 00 28 01'
  '00 00 46 00 00 00 10 10 00 00 01 00 08 00 68 05'
@@ -640,7 +640,7 @@ END
 } */
 
 /* BINRES folder_open.ico */
-4 ICON folder_open.ico
+IDI_SHELL_FOLDER_OPEN ICON folder_open.ico
 /* {
  '00 00 01 00 01 00 10 10 10 00 00 00 00 00 68 05'
  '00 00 16 00 00 00 28 00 00 00 10 00 00 00 20 00'
@@ -733,7 +733,7 @@ END
 } */
 
 /* BINRES floppy.ico */
-5 ICON floppy.ico
+IDI_SHELL_FLOPPY ICON floppy.ico
 /* {
  '00 00 01 00 09 00 20 20 00 00 01 00 08 00 A8 08'
  '00 00 96 00 00 00 10 10 00 00 01 00 08 00 68 05'
@@ -2315,7 +2315,7 @@ END
 
 
 /* BINRES drive.ico */
-8 ICON drive.ico
+IDI_SHELL_DRIVE ICON drive.ico
 /* {
  '00 00 01 00 08 00 20 20 00 00 01 00 08 00 A8 08'
  '00 00 86 00 00 00 10 10 00 00 01 00 08 00 68 05'
@@ -3793,7 +3793,7 @@ END
 } */
 
 /* BINRES netdrive.ico */
-9 ICON netdrive.ico
+IDI_SHELL_NETDRIVE ICON netdrive.ico
 /* {
  '00 00 01 00 09 00 20 20 00 00 01 00 08 00 A8 08'
  '00 00 96 00 00 00 10 10 00 00 01 00 08 00 68 05'
@@ -5374,7 +5374,7 @@ END
 } */
 
 /* BINRES netdrive2.ico */
-10 ICON netdrive2.ico
+IDI_SHELL_NETDRIVE2 ICON netdrive2.ico
 /* {
  '00 00 01 00 09 00 20 20 00 00 01 00 08 00 A8 08'
  '00 00 96 00 00 00 10 10 00 00 01 00 08 00 68 05'
@@ -6955,7 +6955,7 @@ END
 } */
 
 /* BINRES cdrom.ico */
-11 ICON cdrom.ico
+IDI_SHELL_CDROM ICON cdrom.ico
 /* {
  '00 00 01 00 09 00 20 20 00 00 01 00 08 00 A8 08'
  '00 00 96 00 00 00 10 10 00 00 01 00 08 00 68 05'
@@ -8536,7 +8536,7 @@ END
 } */
 
 /* BINRES ramdisk.ico */
-12 ICON ramdisk.ico
+IDI_SHELL_RAMDISK ICON ramdisk.ico
 /* {
  '00 00 01 00 07 00 20 20 00 00 01 00 04 00 E8 02'
  '00 00 76 00 00 00 10 10 00 00 01 00 08 00 68 05'
@@ -9908,7 +9908,7 @@ END
 
 
 /* BINRES mycomputer.ico */
-15 ICON mycomputer.ico
+IDI_SHELL_MYCOMPUTER ICON mycomputer.ico
 /* {
  '00 00 01 00 02 00 10 10 10 00 01 00 04 00 28 01'
  '00 00 26 00 00 00 20 20 10 00 01 00 04 00 E8 02'
@@ -9980,11 +9980,81 @@ END
  'FF FF FF FF FF FF'
 } */
 
-
-
+/* BINRES printer.ico */
+IDI_SHELL_PRINTER ICON printer.ico
+/* {
+ '00 00 01 00 02 00 20 20 10 00 00 00 00 00 E8 02'
+ '00 00 26 00 00 00 10 10 10 00 00 00 00 00 28 01'
+ '00 00 0E 03 00 00 28 00 00 00 20 00 00 00 40 00'
+ '00 00 01 00 04 00 00 00 00 00 80 02 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 80 00 00 80 00 00 00 80 80 00 80 00'
+ '00 00 80 00 80 00 80 80 00 00 C0 C0 C0 00 80 80'
+ '80 00 00 00 FF 00 00 FF 00 00 00 FF FF 00 FF 00'
+ '00 00 FF 00 FF 00 FF FF 00 00 FF FF FF 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '08 88 88 88 88 88 88 88 88 80 00 00 00 00 00 00'
+ '08 88 88 88 88 88 88 88 88 80 00 00 00 00 00 00'
+ '08 88 88 88 88 8A A8 89 98 80 00 00 00 00 00 00'
+ '08 88 88 88 88 8A A8 89 98 80 00 00 00 00 00 00'
+ '08 88 88 88 88 88 88 88 88 80 00 00 00 00 00 00'
+ '08 88 88 88 88 88 88 88 88 80 00 00 00 00 00 00'
+ '00 77 77 77 77 77 77 77 77 77 00 00 00 00 00 00'
+ '00 07 77 77 77 77 77 77 77 77 70 00 00 00 00 00'
+ '00 00 77 77 77 77 77 77 77 77 77 00 00 00 00 00'
+ '00 00 07 7F FF FF FF FF FF FF FF 70 00 00 00 00'
+ '00 00 00 7F FF FF FF FF FF FF FF 77 00 00 00 00'
+ '00 00 00 0F FF FF FF FF FF FF FF 77 70 00 00 00'
+ '00 00 00 0F FF 00 00 00 00 0F FF 00 00 00 00 00'
+ '00 00 00 00 FF FF FF FF FF FF FF F0 00 00 00 00'
+ '00 00 00 00 FF FF FF FF FF FF FF F0 00 00 00 00'
+ '00 00 00 00 FF F0 00 00 00 00 FF F0 00 00 00 00'
+ '00 00 00 00 FF FF FF FF FF FF FF F0 00 00 00 00'
+ '00 00 00 00 0F FF FF FF FF FF FF FF 00 00 00 00'
+ '00 00 00 00 0F FF 00 00 00 00 0F FF 00 00 00 00'
+ '00 00 00 00 0F FF FF FF FF FF FF FF 00 00 00 00'
+ '00 00 00 00 0F FF FF FF FF FF FF FF 00 00 00 00'
+ '00 00 00 00 00 FF F0 00 00 00 00 FF F0 00 00 00'
+ '00 00 00 00 00 FF FF FF FF FF FF FF F0 00 00 00'
+ '00 00 00 00 00 FF FF FF FF FF FF FF F0 00 00 00'
+ '00 00 00 00 00 FF FF FF FF FF FF FF F0 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF'
+ 'FF FF FF FF FF FF FF FF FF FF F8 00 00 FF F8 00'
+ '00 7F F8 00 00 3F F8 00 00 1F F8 00 00 0F F8 00'
+ '00 07 FC 00 00 07 FE 00 00 07 FF 00 00 07 FF 80'
+ '00 07 FF C0 00 07 FF E0 00 07 FF E0 00 3F FF F0'
+ '00 1F FF F0 00 1F FF F0 00 1F FF F0 00 1F FF F8'
+ '00 0F FF F8 00 0F FF F8 00 0F FF F8 00 0F FF FC'
+ '00 07 FF FC 00 07 FF FC 00 07 FF FC 00 07 FF FF'
+ 'FF FF FF FF FF FF FF FF FF FF FF FF FF FF 28 00'
+ '00 00 10 00 00 00 20 00 00 00 01 00 04 00 00 00'
+ '00 00 C0 00 00 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80'
+ '00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80'
+ '00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF'
+ '00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF'
+ '00 00 FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 00 88 88 88 88 88 00 00 00 88'
+ '88 AA 89 98 00 00 00 88 88 88 88 88 00 00 00 77'
+ '77 77 77 77 70 00 00 07 7F FF FF FF 77 00 00 00'
+ '7F FF FF FF 77 70 00 00 0F 00 00 0F 00 00 00 00'
+ '0F FF FF FF F0 00 00 00 00 F0 00 00 F0 00 00 00'
+ '00 FF FF FF FF 00 00 00 00 0F 00 00 0F 00 00 00'
+ '00 0F FF FF FF 00 00 00 00 00 00 00 00 00 00 00'
+ '00 00 00 00 00 00 FF FF 00 00 FF FF 00 00 C0 07'
+ '00 00 C0 03 00 00 C0 01 00 00 C0 01 00 00 E0 01'
+ '00 00 F0 01 00 00 F8 0F 00 00 F8 07 00 00 FC 07'
+ '00 00 FC 03 00 00 FE 03 00 00 FE 03 00 00 FF FF'
+ '00 00 FF FF 00 00'
+} */
 
 /* BINRES desktop.ico */
-34 ICON desktop.ico
+IDI_SHELL_DESKTOP ICON desktop.ico
 /* {
  '00 00 01 00 02 00 10 10 10 00 00 00 00 00 28 01'
  '00 00 26 00 00 00 20 20 10 00 00 00 00 00 E8 02'
Index: dlls/shell32/shresdef.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shresdef.h,v
retrieving revision 1.13
diff -u -p -r1.13 shresdef.h
--- dlls/shell32/shresdef.h	21 Oct 2004 19:59:46 -0000	1.13
+++ dlls/shell32/shresdef.h	6 Apr 2005 13:39:49 -0000
@@ -89,4 +89,17 @@
 #define IDD_TITLE		0x3742
 #define IDD_TREEVIEW		0x3741
 
+#define IDI_SHELL_DOCUMENT           1
+#define IDI_SHELL_FOLDER             4
+#define IDI_SHELL_FOLDER_OPEN        5
+#define IDI_SHELL_FLOPPY             6
+#define IDI_SHELL_DRIVE              9
+#define IDI_SHELL_NETDRIVE          10
+#define IDI_SHELL_NETDRIVE2         11
+#define IDI_SHELL_CDROM             12
+#define IDI_SHELL_RAMDISK           13
+#define IDI_SHELL_MYCOMPUTER        16
+#define IDI_SHELL_PRINTER           17
+#define IDI_SHELL_DESKTOP           35
+
 #endif



More information about the wine-patches mailing list