Mikołaj Zalewski : shell32: Add a custom icon for the trash folder.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Aug 9 06:03:33 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 4bb595e4c607abe7af5122ce68ece41df7093ded
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=4bb595e4c607abe7af5122ce68ece41df7093ded

Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date:   Thu Aug  3 19:09:52 2006 +0200

shell32: Add a custom icon for the trash folder.

---

 dlls/shell32/regsvr.c |   23 ++++++++++++++++++++++-
 dlls/shell32/shres.rc |    2 ++
 2 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/dlls/shell32/regsvr.c b/dlls/shell32/regsvr.c
index cb8f69b..9586342 100644
--- a/dlls/shell32/regsvr.c
+++ b/dlls/shell32/regsvr.c
@@ -73,6 +73,7 @@ struct regsvr_coclass
     DWORD dwCallForAttributes;
     LPCSTR clsid_str;		/* can be NULL to omit */
     LPCSTR progid;		/* can be NULL to omit */
+    UINT idDefaultIcon;         /* can be 0 to omit */
 };
 
 /* flags for regsvr_coclass.flags */
@@ -127,6 +128,8 @@ static WCHAR const shellfolder_keyname[1
 static WCHAR const mcdm_keyname[21] = {
     'M', 'a', 'y', 'C', 'h', 'a', 'n', 'g', 'e', 'D', 'e', 'f',
     'a', 'u', 'l', 't', 'M', 'e', 'n', 'u', 0 };
+static WCHAR const defaulticon_keyname[] = {
+    'D','e','f','a','u','l','t','I','c','o','n',0};
 static char const tmodel_valuename[] = "ThreadingModel";
 static char const wfparsing_valuename[] = "WantsFORPARSING";
 static char const attributes_valuename[] = "Attributes";
@@ -275,6 +278,21 @@ static HRESULT register_coclasses(struct
                                  (CONST BYTE*)(buffer), strlen(buffer)+1);
             if (res != ERROR_SUCCESS) goto error_close_clsid_key;
         }
+        
+        if (list->idDefaultIcon) {
+            HKEY icon_key;
+            char buffer[64] = "%SYSTEMROOT%\\system32\\shell32.dll,-";
+
+            res = RegCreateKeyExW(clsid_key, defaulticon_keyname, 0, NULL, 0,
+                        KEY_READ | KEY_WRITE, NULL, &icon_key, NULL);
+            if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+
+            sprintf(buffer+strlen(buffer), "%u", list->idDefaultIcon);
+            res = RegSetValueExA(icon_key, NULL, 0, REG_EXPAND_SZ,
+                                 (CONST BYTE*)(buffer), strlen(buffer)+1);
+            RegCloseKey(icon_key);
+            if (res != ERROR_SUCCESS) goto error_close_clsid_key;
+        }
 
 	if (list->ips) {
 	    res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
@@ -668,7 +686,10 @@ static struct regsvr_coclass const cocla
 	"Apartment",
 	SHELLFOLDER_ATTRIBUTES,
 	SFGAO_FOLDER|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET,
-	0
+	0,
+	NULL,
+	NULL,
+	IDI_SHELL_FULL_RECYCLE_BIN
     },
     { NULL }			/* list terminator */
 };
diff --git a/dlls/shell32/shres.rc b/dlls/shell32/shres.rc
index c4f982b..c9757dd 100644
--- a/dlls/shell32/shres.rc
+++ b/dlls/shell32/shres.rc
@@ -10531,6 +10531,8 @@ IDI_SHELL_DESKTOP ICON desktop.ico
  'FF FF FF FF FF FF'
 } */
 
+IDI_SHELL_FULL_RECYCLE_BIN ICON trash_file.ico
+
 /* BINRES trash_file.ico */
 IDI_SHELL_TRASH_FILE ICON trash_file.ico
 /* {




More information about the wine-cvs mailing list