Author: gadamopoulos Date: Sat Mar 28 19:45:27 2015 New Revision: 66936 URL: http://svn.reactos.org/svn/reactos?rev=66936&view=rev Log: [SHELL32] - CDefaultContextMenu: Reduce relying on the type of the pidl. Query the attributes of the item from the folder instead. CORE-8973
Modified: trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp Modified: trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp?rev=66936&r1=66935&r2=66936&view=diff ============================================================================== --- trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/CDefaultContextMenu.cpp [iso-8859-1] Sat Mar 28 19:45:27 2015 @@ -514,6 +514,14 @@ 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 @@ } /* 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 @@ } /* 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 @@ } /* 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) {