mirror of
https://github.com/reactos/reactos.git
synced 2024-10-02 07:26:47 +00:00
[SHELL32]
* Make the Recycle Bin icon reflect whether the bin is empty or not. Brought to you by Huw Campbell. CORE-3712 #resolve #comment Committed in r61293. Cheers ;) svn path=/trunk/; revision=61293
This commit is contained in:
parent
ea4d6f444e
commit
e9a8c50011
|
@ -188,11 +188,6 @@ BOOL HCR_GetExecuteCommandW(HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPW
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************************
|
|
||||||
* HCR_GetDefaultIcon [internal]
|
|
||||||
*
|
|
||||||
* Gets the icon for a filetype
|
|
||||||
*/
|
|
||||||
static BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
|
static BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
|
||||||
{
|
{
|
||||||
WCHAR xriid[50];
|
WCHAR xriid[50];
|
||||||
|
@ -206,13 +201,18 @@ static BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey)
|
||||||
return (RegOpenKeyExW(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey) == ERROR_SUCCESS);
|
return (RegOpenKeyExW(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey) == ERROR_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL HCR_RegGetDefaultIconW(HKEY hkey, LPWSTR szDest, DWORD len, int* picon_idx)
|
/***************************************************************************************
|
||||||
|
* HCR_GetIcon [internal]
|
||||||
|
*
|
||||||
|
* Gets the icon for a filetype, szName can be NULL, in which case the default icon is loaded
|
||||||
|
*/
|
||||||
|
static BOOL HCR_RegGetIconW(HKEY hkey, LPWSTR szDest, LPWSTR szName, DWORD len, int* picon_idx)
|
||||||
{
|
{
|
||||||
DWORD dwType;
|
DWORD dwType;
|
||||||
WCHAR sTemp[MAX_PATH];
|
WCHAR sTemp[MAX_PATH];
|
||||||
WCHAR sNum[7];
|
WCHAR sNum[7];
|
||||||
|
|
||||||
if (!RegQueryValueExW(hkey, NULL, 0, &dwType, (LPBYTE)szDest, &len))
|
if (!RegQueryValueExW(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len))
|
||||||
{
|
{
|
||||||
if (dwType == REG_EXPAND_SZ)
|
if (dwType == REG_EXPAND_SZ)
|
||||||
{
|
{
|
||||||
|
@ -230,13 +230,13 @@ static BOOL HCR_RegGetDefaultIconW(HKEY hkey, LPWSTR szDest, DWORD len, int* pic
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL HCR_RegGetDefaultIconA(HKEY hkey, LPSTR szDest, DWORD len, int* picon_idx)
|
static BOOL HCR_RegGetIconA(HKEY hkey, LPSTR szDest, LPSTR szName, DWORD len, int* picon_idx)
|
||||||
{
|
{
|
||||||
DWORD dwType;
|
DWORD dwType;
|
||||||
char sTemp[MAX_PATH];
|
char sTemp[MAX_PATH];
|
||||||
char sNum[5];
|
char sNum[5];
|
||||||
|
|
||||||
if (!RegQueryValueExA(hkey, NULL, 0, &dwType, (LPBYTE)szDest, &len))
|
if (!RegQueryValueExA(hkey, szName, 0, &dwType, (LPBYTE)szDest, &len))
|
||||||
{
|
{
|
||||||
if (dwType == REG_EXPAND_SZ)
|
if (dwType == REG_EXPAND_SZ)
|
||||||
{
|
{
|
||||||
|
@ -254,7 +254,7 @@ static BOOL HCR_RegGetDefaultIconA(HKEY hkey, LPSTR szDest, DWORD len, int* pico
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_idx)
|
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPWSTR szName, DWORD len, int* picon_idx)
|
||||||
{
|
{
|
||||||
static const WCHAR swDefaultIcon[] = L"\\DefaultIcon";
|
static const WCHAR swDefaultIcon[] = L"\\DefaultIcon";
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
|
@ -268,7 +268,7 @@ BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_i
|
||||||
|
|
||||||
if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey))
|
if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey))
|
||||||
{
|
{
|
||||||
ret = HCR_RegGetDefaultIconW(hKey, szDest, len, picon_idx);
|
ret = HCR_RegGetIconW(hKey, szDest, szName, len, picon_idx);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_i
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, int* picon_idx)
|
BOOL HCR_GetIconA(LPCSTR szClass, LPSTR szDest, LPSTR szName, DWORD len, int* picon_idx)
|
||||||
{
|
{
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
char sTemp[MAX_PATH];
|
char sTemp[MAX_PATH];
|
||||||
|
@ -292,21 +292,21 @@ BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, int* picon_idx
|
||||||
|
|
||||||
if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey))
|
if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hKey))
|
||||||
{
|
{
|
||||||
ret = HCR_RegGetDefaultIconA(hKey, szDest, len, picon_idx);
|
ret = HCR_RegGetIconA(hKey, szDest, szName, len, picon_idx);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
TRACE("-- %s %i\n", szDest, *picon_idx);
|
TRACE("-- %s %i\n", szDest, *picon_idx);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL HCR_GetDefaultIconFromGUIDW(REFIID riid, LPWSTR szDest, DWORD len, int* picon_idx)
|
BOOL HCR_GetIconFromGUIDW(REFIID riid, LPWSTR szDest, LPWSTR szName, DWORD len, int* picon_idx)
|
||||||
{
|
{
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
if (HCR_RegOpenClassIDKey(riid, &hKey))
|
if (HCR_RegOpenClassIDKey(riid, &hKey))
|
||||||
{
|
{
|
||||||
ret = HCR_RegGetDefaultIconW(hKey, szDest, len, picon_idx);
|
ret = HCR_RegGetIconW(hKey, szDest, szName, len, picon_idx);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx);
|
TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx);
|
||||||
|
|
|
@ -48,13 +48,13 @@ static HRESULT getIconLocationForFolder(LPCITEMIDLIST pidl, UINT uFlags,
|
||||||
}
|
}
|
||||||
else if (SHELL32_GetCustomFolderAttribute(pidl, shellClassInfo, clsid,
|
else if (SHELL32_GetCustomFolderAttribute(pidl, shellClassInfo, clsid,
|
||||||
wszCLSIDValue, CHARS_IN_GUID) &&
|
wszCLSIDValue, CHARS_IN_GUID) &&
|
||||||
HCR_GetDefaultIconW(wszCLSIDValue, szIconFile, cchMax, &icon_idx))
|
HCR_GetIconW(wszCLSIDValue, szIconFile, NULL, cchMax, &icon_idx))
|
||||||
{
|
{
|
||||||
*piIndex = icon_idx;
|
*piIndex = icon_idx;
|
||||||
}
|
}
|
||||||
else if (SHELL32_GetCustomFolderAttribute(pidl, shellClassInfo, clsid2,
|
else if (SHELL32_GetCustomFolderAttribute(pidl, shellClassInfo, clsid2,
|
||||||
wszCLSIDValue, CHARS_IN_GUID) &&
|
wszCLSIDValue, CHARS_IN_GUID) &&
|
||||||
HCR_GetDefaultIconW(wszCLSIDValue, szIconFile, cchMax, &icon_idx))
|
HCR_GetIconW(wszCLSIDValue, szIconFile, NULL, cchMax, &icon_idx))
|
||||||
{
|
{
|
||||||
*piIndex = icon_idx;
|
*piIndex = icon_idx;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ static HRESULT getIconLocationForFolder(LPCITEMIDLIST pidl, UINT uFlags,
|
||||||
{
|
{
|
||||||
static const WCHAR folder[] = { 'F', 'o', 'l', 'd', 'e', 'r', 0 };
|
static const WCHAR folder[] = { 'F', 'o', 'l', 'd', 'e', 'r', 0 };
|
||||||
|
|
||||||
if (!HCR_GetDefaultIconW(folder, szIconFile, cchMax, &icon_idx))
|
if (!HCR_GetIconW(folder, szIconFile, NULL, cchMax, &icon_idx))
|
||||||
{
|
{
|
||||||
lstrcpynW(szIconFile, swShell32Name, cchMax);
|
lstrcpynW(szIconFile, swShell32Name, cchMax);
|
||||||
icon_idx = -IDI_SHELL_FOLDER;
|
icon_idx = -IDI_SHELL_FOLDER;
|
||||||
|
@ -224,7 +224,40 @@ IExtractIconW* IExtractIconW_Constructor(LPCITEMIDLIST pidl)
|
||||||
riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
|
riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
|
||||||
riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]);
|
riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]);
|
||||||
|
|
||||||
if (HCR_GetDefaultIconW(xriid, wTemp, MAX_PATH, &icon_idx))
|
WCHAR* iconname = NULL;
|
||||||
|
if (_ILIsBitBucket(pSimplePidl))
|
||||||
|
{
|
||||||
|
IEnumIDList *EnumIDList = NULL;
|
||||||
|
CoInitialize(NULL);
|
||||||
|
|
||||||
|
IShellFolder2 *psfRecycleBin = NULL;
|
||||||
|
IShellFolder *psfDesktop = NULL;
|
||||||
|
hr = SHGetDesktopFolder(&psfDesktop);
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
hr = psfDesktop->BindToObject(pSimplePidl, NULL, IID_IShellFolder2, (void**) &psfRecycleBin);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
hr = psfRecycleBin->EnumObjects(NULL, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, &EnumIDList);
|
||||||
|
|
||||||
|
ULONG itemcount;
|
||||||
|
LPITEMIDLIST pidl = NULL;
|
||||||
|
if (SUCCEEDED(hr) && (hr = EnumIDList->Next(1, &pidl, &itemcount)) == S_OK)
|
||||||
|
{
|
||||||
|
CoTaskMemFree(pidl);
|
||||||
|
iconname = L"Full";
|
||||||
|
} else {
|
||||||
|
iconname = L"Empty";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (psfDesktop)
|
||||||
|
psfDesktop->Release();
|
||||||
|
if (psfRecycleBin)
|
||||||
|
psfRecycleBin->Release();
|
||||||
|
if (EnumIDList)
|
||||||
|
EnumIDList->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (HCR_GetIconW(xriid, wTemp, iconname, MAX_PATH, &icon_idx))
|
||||||
{
|
{
|
||||||
initIcon->SetNormalIcon(wTemp, icon_idx);
|
initIcon->SetNormalIcon(wTemp, icon_idx);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +307,7 @@ IExtractIconW* IExtractIconW_Constructor(LPCITEMIDLIST pidl)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (HCR_GetDefaultIconW(drive, wTemp, MAX_PATH, &icon_idx))
|
if (HCR_GetIconW(drive, wTemp, NULL, MAX_PATH, &icon_idx))
|
||||||
initIcon->SetNormalIcon(wTemp, icon_idx);
|
initIcon->SetNormalIcon(wTemp, icon_idx);
|
||||||
else
|
else
|
||||||
initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_DRIVE);
|
initIcon->SetNormalIcon(swShell32Name, -IDI_SHELL_DRIVE);
|
||||||
|
@ -324,7 +357,7 @@ IExtractIconW* IExtractIconW_Constructor(LPCITEMIDLIST pidl)
|
||||||
else if (_ILGetExtension(pSimplePidl, sTemp, MAX_PATH))
|
else if (_ILGetExtension(pSimplePidl, sTemp, MAX_PATH))
|
||||||
{
|
{
|
||||||
if (HCR_MapTypeToValueA(sTemp, sTemp, MAX_PATH, TRUE)
|
if (HCR_MapTypeToValueA(sTemp, sTemp, MAX_PATH, TRUE)
|
||||||
&& HCR_GetDefaultIconA(sTemp, sTemp, MAX_PATH, &icon_idx))
|
&& HCR_GetIconA(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
|
||||||
{
|
{
|
||||||
if (!lstrcmpA("%1", sTemp)) /* icon is in the file */
|
if (!lstrcmpA("%1", sTemp)) /* icon is in the file */
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,14 +6,14 @@ HKCR
|
||||||
{
|
{
|
||||||
val 'InfoTip' = e '@%%SystemRoot%%\system32\SHELL32.dll,-22915'
|
val 'InfoTip' = e '@%%SystemRoot%%\system32\SHELL32.dll,-22915'
|
||||||
val 'IntroText' = e '@%%SystemRoot%%\system32\SHELL32.dll,-31748'
|
val 'IntroText' = e '@%%SystemRoot%%\system32\SHELL32.dll,-31748'
|
||||||
val 'LocalizedString' = e '@%%SystemRoot%%\system32\SHELL32.dll,-8964'
|
val 'LocalizedString' = e '@%%SystemRoot%%\system32\SHELL32.dll,-8964'
|
||||||
DefaultIcon = e '%%SystemRoot%%\System32\shell32.dll,31'
|
DefaultIcon = e '%%SystemRoot%%\System32\shell32.dll,31'
|
||||||
{
|
{
|
||||||
val Empty = e '%%SystemRoot%%\System32\shell32.dll,31'
|
val Empty = e '%%SystemRoot%%\System32\shell32.dll,30'
|
||||||
val Full = e '%%SystemRoot%%\System32\shell32.dll,32'
|
val Full = e '%%SystemRoot%%\System32\shell32.dll,31'
|
||||||
}
|
}
|
||||||
InprocServer32 = s '%MODULE%'
|
InprocServer32 = s '%MODULE%'
|
||||||
{
|
{
|
||||||
val ThreadingModel = s 'Apartment'
|
val ThreadingModel = s 'Apartment'
|
||||||
}
|
}
|
||||||
'ShellFolder'
|
'ShellFolder'
|
||||||
|
|
|
@ -584,7 +584,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
||||||
TRACE("szExt=%s\n", debugstr_w(szExt));
|
TRACE("szExt=%s\n", debugstr_w(szExt));
|
||||||
if ( szExt &&
|
if ( szExt &&
|
||||||
HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
|
HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
|
||||||
HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &psfi->iIcon))
|
HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &psfi->iIcon))
|
||||||
{
|
{
|
||||||
if (lstrcmpW(p1W, sTemp))
|
if (lstrcmpW(p1W, sTemp))
|
||||||
wcscpy(psfi->szDisplayName, sTemp);
|
wcscpy(psfi->szDisplayName, sTemp);
|
||||||
|
@ -640,7 +640,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
|
||||||
szExt = PathFindExtensionW(sTemp);
|
szExt = PathFindExtensionW(sTemp);
|
||||||
if ( szExt &&
|
if ( szExt &&
|
||||||
HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
|
HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
|
||||||
HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &icon_idx))
|
HCR_GetIconW(sTemp, sTemp, NULL, MAX_PATH, &icon_idx))
|
||||||
{
|
{
|
||||||
if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
|
if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */
|
||||||
wcscpy(sTemp, szFullPath);
|
wcscpy(sTemp, szFullPath);
|
||||||
|
|
|
@ -46,17 +46,16 @@ INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags );
|
||||||
BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot);
|
BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot);
|
||||||
BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
|
BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
|
||||||
BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
|
BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len );
|
||||||
BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_idx);
|
BOOL HCR_GetIconW(LPCWSTR szClass, LPWSTR szDest, LPWSTR szName, DWORD len, int* picon_idx);
|
||||||
BOOL HCR_GetDefaultIconFromGUIDW(REFIID riid, LPWSTR szDest, DWORD len, int* picon_idx);
|
BOOL HCR_GetIconFromGUIDW(REFIID riid, LPWSTR szDest, LPWSTR szName, DWORD len, int* picon_idx);
|
||||||
BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len);
|
BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len);
|
||||||
|
|
||||||
/* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
|
/* ANSI versions of above functions, supposed to go away as soon as they are not used anymore */
|
||||||
BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot);
|
BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot);
|
||||||
BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, int* picon_idx);
|
BOOL HCR_GetIconA(LPCSTR szClass, LPSTR szDest, LPSTR sName, DWORD len, int* picon_idx);
|
||||||
BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len);
|
BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len);
|
||||||
|
|
||||||
BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD dwAttributes);
|
BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD dwAttributes);
|
||||||
|
|
||||||
INT_PTR CALLBACK AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
|
INT_PTR CALLBACK AboutDlgProc(HWND,UINT,WPARAM,LPARAM);
|
||||||
DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len);
|
DWORD WINAPI ParseFieldA(LPCSTR src, DWORD nField, LPSTR dst, DWORD len);
|
||||||
DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len);
|
DWORD WINAPI ParseFieldW(LPCWSTR src, DWORD nField, LPWSTR dst, DWORD len);
|
||||||
|
|
Loading…
Reference in a new issue