From 4bb595e4c607abe7af5122ce68ece41df7093ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Zalewski?= Date: Thu, 3 Aug 2006 19:09:52 +0200 Subject: [PATCH] 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 deletion(-) diff --git a/dlls/shell32/regsvr.c b/dlls/shell32/regsvr.c index cb8f69b3145..9586342a8dc 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[12] = { 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 regsvr_coclass const *list) (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 coclass_list[] = { "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 c4f982b9054..c9757dd0dcb 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 /* {