[SHELL32]

- Fix Recycle Bin attributes. Context menu does not have "Delete" option anymore.
- Minor code improvements

svn path=/trunk/; revision=54687
This commit is contained in:
Rafal Harabien 2011-12-18 22:56:13 +00:00
parent 0edd7dacb4
commit 9286dc7ef8
5 changed files with 25 additions and 21 deletions

View file

@ -470,7 +470,10 @@ BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes)
lResult = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszShellFolderKey, 0, KEY_READ, &hSFKey);
if (lResult != ERROR_SUCCESS)
{
ERR("Cannot open key: %ls\n", wszShellFolderKey);
return FALSE;
}
dwLen = sizeof(DWORD);
lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen);

View file

@ -858,7 +858,6 @@ CDefaultContextMenu::BuildShellItemContextMenu(
}
}
if (rfg & SFGAO_FILESYSTEM)
{
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"AllFilesystemObjects", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
@ -899,7 +898,6 @@ CDefaultContextMenu::BuildShellItemContextMenu(
bAddSep = TRUE;
}
if (rfg & SFGAO_CANLINK)
{
bAddSep = FALSE;
@ -907,7 +905,6 @@ CDefaultContextMenu::BuildShellItemContextMenu(
_InsertMenuItemW(hMenu, indexMenu++, TRUE, FCIDM_SHVIEW_CREATELINK, MFT_STRING, MAKEINTRESOURCEW(IDS_CREATELINK), MFS_ENABLED);
}
if (rfg & SFGAO_CANDELETE)
{
if (bAddSep)

View file

@ -546,8 +546,8 @@ HRESULT WINAPI CDesktopFolder::GetAttributesOf(
SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET |
SFGAO_DROPTARGET | SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
TRACE ("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n",
this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0);
if (!rgfInOut)
return E_INVALIDARG;
@ -557,18 +557,22 @@ HRESULT WINAPI CDesktopFolder::GetAttributesOf(
if (*rgfInOut == 0)
*rgfInOut = ~0;
if(cidl == 0) {
if(cidl == 0)
{
*rgfInOut &= dwDesktopAttributes;
} else {
while (cidl > 0 && *apidl) {
pdump (*apidl);
if (_ILIsDesktop(*apidl)) {
}
else
{
while (cidl > 0 && *apidl)
{
pdump(*apidl);
if (_ILIsDesktop(*apidl))
*rgfInOut &= dwDesktopAttributes;
} else if (_ILIsMyComputer(*apidl)) {
else if (_ILIsMyComputer(*apidl))
*rgfInOut &= dwMyComputerAttributes;
} else {
SHELL32_GetItemAttributes ((IShellFolder *)this, *apidl, rgfInOut);
}
else
SHELL32_GetItemAttributes((IShellFolder *)this, *apidl, rgfInOut);
apidl++;
cidl--;
}
@ -576,7 +580,7 @@ HRESULT WINAPI CDesktopFolder::GetAttributesOf(
/* make sure SFGAO_VALIDATE is cleared, some apps depend on that */
*rgfInOut &= ~SFGAO_VALIDATE;
TRACE ("-- result=0x%08x\n", *rgfInOut);
TRACE("-- result=0x%08x\n", *rgfInOut);
return hr;
}

View file

@ -583,7 +583,7 @@ HRESULT WINAPI CRecycleBin::GetAttributesOf(UINT cidl, LPCITEMIDLIST *apidl,
SFGAOF *rgfInOut)
{
TRACE("(%p, %d, {%p, ...}, {%x})\n", this, cidl, apidl ? apidl[0] : NULL, (unsigned int)*rgfInOut);
*rgfInOut &= SFGAO_CANMOVE | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM | SFGAO_FOLDER;
*rgfInOut &= SFGAO_FOLDER|SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANLINK;
return S_OK;
}

View file

@ -398,18 +398,18 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
dwAttributes = *pdwAttributes;
/* Attributes of some special folders are hardcoded */
if (_ILIsDrive(pidl)) {
if (_ILIsDrive(pidl))
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FILESYSTEM|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANRENAME;
} else if (_ILIsMyComputer(pidl) || _ILIsNetHood(pidl)) {
else if (_ILIsMyComputer(pidl) || _ILIsNetHood(pidl))
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_FILESYSANCESTOR|
SFGAO_DROPTARGET|SFGAO_HASPROPSHEET|SFGAO_CANDELETE|
SFGAO_CANRENAME|SFGAO_CANLINK;
} else if (_ILIsControlPanel(pidl)) {
else if (_ILIsControlPanel(pidl))
*pdwAttributes &= SFGAO_HASSUBFOLDER|SFGAO_FOLDER|SFGAO_CANLINK;
} else if (has_guid && HCR_GetFolderAttributes(pidl, &dwAttributes)) {
else if (has_guid && HCR_GetFolderAttributes(pidl, &dwAttributes))
*pdwAttributes = dwAttributes;
} else if (_ILGetDataPointer(pidl))
else if (_ILGetDataPointer(pidl))
{
dwAttributes = _ILGetFileAttributes(pidl, NULL, 0);