[SHELL32]

- CDefaultContextMenu: Reduce relying on the type of the pidl. Query the attributes of the item from the folder instead. 
CORE-8973

svn path=/trunk/; revision=66936
This commit is contained in:
Giannis Adamopoulos 2015-03-28 19:45:27 +00:00
parent 3170beeda2
commit 261ee47cac

View file

@ -514,6 +514,14 @@ CDefaultContextMenu::BuildBackgroundContextMenu(
TRACE("BuildBackgroundContextMenu entered\n");
SFGAOF rfg = SFGAO_FILESYSTEM | SFGAO_FOLDER;
HRESULT hr = m_psf->GetAttributesOf(0, NULL, &rfg);
if (FAILED(hr))
{
ERR("GetAttributesOf failed: %x\n", hr);
rfg = 0;
}
if (!_ILIsDesktop(m_pidlFolder))
{
WCHAR wszBuf[MAX_PATH];
@ -554,8 +562,7 @@ CDefaultContextMenu::BuildBackgroundContextMenu(
}
/* Directory is progid of filesystem folders only */
LPITEMIDLIST pidlFolderLast = ILFindLastID(m_pidlFolder);
if (_ILIsDesktop(pidlFolderLast) || _ILIsDrive(pidlFolderLast) || _ILIsFolder(pidlFolderLast))
if (rfg == (SFGAO_FILESYSTEM|SFGAO_FOLDER))
{
/* Load context menu handlers */
TRACE("Add background handlers: %p\n", m_pidlFolder);
@ -818,7 +825,7 @@ CDefaultContextMenu::BuildShellItemContextMenu(
}
/* Directory is only loaded for real filesystem directories */
if (_ILIsFolder(m_apidl[0]))
if (rfg & SFGAO_FILESYSTEM)
{
AddStaticEntryForFileClass(L"Directory");
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"Directory", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
@ -830,7 +837,7 @@ CDefaultContextMenu::BuildShellItemContextMenu(
}
/* AllFilesystemObjects class is loaded only for files and directories */
if (_ILIsFolder(m_apidl[0]) || _ILIsValue(m_apidl[0]))
if (rfg & SFGAO_FILESYSTEM)
{
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"AllFilesystemObjects", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{