Author: gadamopoulos Date: Sun Aug 30 14:28:07 2015 New Revision: 68873
URL: http://svn.reactos.org/svn/reactos?rev=68873&view=rev Log: [SHELL32] - Remove SHELL32_GetItemAttributes for good. It is never a good idea to have one function that handles many types of pidls.
Modified: trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp trunk/reactos/dll/win32/shell32/shfldr.h trunk/reactos/dll/win32/shell32/shlfolder.cpp
Modified: trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/C... ============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp [iso-8859-1] Sun Aug 30 14:28:07 2015 @@ -335,8 +335,14 @@ else { if (pdwAttributes && *pdwAttributes) - hr = SHELL32_GetItemAttributes(this, - pidlTemp, pdwAttributes); + { + if (_ILIsCPanelStruct(pidlTemp)) + *pdwAttributes &= SFGAO_CANLINK; + else if (_ILIsSpecialFolder(pidlTemp)) + SHELL32_GetGuidItemAttributes(this, pidlTemp, pdwAttributes); + else + ERR("Got an unkown pidl here!\n"); + } } }
Modified: trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/C... ============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp [iso-8859-1] Sun Aug 30 14:28:07 2015 @@ -71,6 +71,17 @@ };
#define DESKTOPSHELLVIEWCOLUMNS 5 + +static const DWORD dwDesktopAttributes = + SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR | + SFGAO_STORAGEANCESTOR | SFGAO_HASPROPSHEET | SFGAO_STORAGE | SFGAO_CANLINK; +static const DWORD dwMyComputerAttributes = + SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | + SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_CANLINK; +static DWORD dwMyNetPlacesAttributes = + SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | + SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_CANLINK; +
CDesktopFolderEnum::CDesktopFolderEnum() { @@ -392,8 +403,16 @@ else { if (pdwAttributes && *pdwAttributes) - hr = SHELL32_GetItemAttributes((IShellFolder *)this, - pidlTemp, pdwAttributes); + { + if (_ILIsMyComputer(pidlTemp)) + *pdwAttributes &= dwMyComputerAttributes; + else if (_ILIsNetHood(pidlTemp)) + *pdwAttributes &= dwMyNetPlacesAttributes; + else if (_ILIsSpecialFolder(pidlTemp)) + SHELL32_GetGuidItemAttributes(this, pidlTemp, pdwAttributes); + else if(_ILIsFolder(pidlTemp) || _ILIsValue(pidlTemp)) + SHELL32_GetFSItemAttributes(this, pidlTemp, pdwAttributes); + } } }
@@ -504,15 +523,6 @@ DWORD *rgfInOut) { HRESULT hr = S_OK; - static const DWORD dwDesktopAttributes = - SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR | - SFGAO_STORAGEANCESTOR | SFGAO_HASPROPSHEET | SFGAO_STORAGE | SFGAO_CANLINK; - static const DWORD dwMyComputerAttributes = - SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | - SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_CANLINK; - static DWORD dwMyNetPlacesAttributes = - SFGAO_CANRENAME | SFGAO_CANDELETE | SFGAO_HASPROPSHEET | SFGAO_DROPTARGET | - SFGAO_FILESYSANCESTOR | SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_CANLINK;
TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", this, cidl, apidl, rgfInOut, rgfInOut ? *rgfInOut : 0); @@ -540,7 +550,7 @@ else if (_ILIsSpecialFolder(apidl[i])) SHELL32_GetGuidItemAttributes(this, apidl[i], rgfInOut); else if(_ILIsFolder(apidl[i]) || _ILIsValue(apidl[i])) - SHELL32_GetItemAttributes(this, apidl[i], rgfInOut); + SHELL32_GetFSItemAttributes(this, apidl[i], rgfInOut); else ERR("Got an unknown pidl type!!!\n"); }
Modified: trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/C... ============================================================================== --- trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp [iso-8859-1] Sun Aug 30 14:28:07 2015 @@ -234,10 +234,16 @@ } else { + hr = S_OK; if (pdwAttributes && *pdwAttributes) - SHELL32_GetItemAttributes (this, - pidlTemp, pdwAttributes); - hr = S_OK; + { + if (_ILIsCPanelStruct(pidlTemp)) + *pdwAttributes &= SFGAO_CANLINK; + else if (_ILIsSpecialFolder(pidlTemp)) + SHELL32_GetGuidItemAttributes(this, pidlTemp, pdwAttributes); + else + ERR("Got an unkown pidl here!\n"); + } }
*ppidl = pidlTemp;
Modified: trunk/reactos/dll/win32/shell32/shfldr.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shfldr.h?... ============================================================================== --- trunk/reactos/dll/win32/shell32/shfldr.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shfldr.h [iso-8859-1] Sun Aug 30 14:28:07 2015 @@ -39,7 +39,6 @@ LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut); HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut, LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes); -HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes); HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPWSTR szOut, DWORD dwOutLen);
Modified: trunk/reactos/dll/win32/shell32/shlfolder.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlfolder... ============================================================================== --- trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shlfolder.cpp [iso-8859-1] Sun Aug 30 14:28:07 2015 @@ -588,35 +588,6 @@ return S_OK; }
-HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes) -{ - TRACE ("0x%08x\n", *pdwAttributes); - - if (*pdwAttributes & ~dwSupportedAttr) - { - WARN ("attributes 0x%08x not implemented\n", (*pdwAttributes & ~dwSupportedAttr)); - *pdwAttributes &= dwSupportedAttr; - } - - if (_ILIsSpecialFolder(pidl)) - { - return SHELL32_GetGuidItemAttributes(psf, pidl, pdwAttributes); - } - else if(_ILIsFolder(pidl) || _ILIsValue(pidl)) - { - return SHELL32_GetFSItemAttributes(psf, pidl, pdwAttributes); - } - else - { - /* Set common attributes */ - ERR("We got a pidl that is neither a guid or an FS item!!! Type=0x%x\n",pidl->mkid.abID[0]); - *pdwAttributes &= SFGAO_CANLINK; - } - - TRACE ("-- 0x%08x\n", *pdwAttributes); - return S_OK; -} - /*********************************************************************** * SHELL32_CompareIDs */