Author: rharabien Date: Sun Dec 18 22:56:13 2011 New Revision: 54687
URL: http://svn.reactos.org/svn/reactos?rev=54687&view=rev Log: [SHELL32] - Fix Recycle Bin attributes. Context menu does not have "Delete" option anymore. - Minor code improvements
Modified: trunk/reactos/dll/win32/shell32/classes.cpp trunk/reactos/dll/win32/shell32/defcontextmenu.cpp trunk/reactos/dll/win32/shell32/folders/desktop.cpp trunk/reactos/dll/win32/shell32/folders/recyclebin.cpp trunk/reactos/dll/win32/shell32/shlfolder.cpp
Modified: trunk/reactos/dll/win32/shell32/classes.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/classes.c... ============================================================================== --- trunk/reactos/dll/win32/shell32/classes.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/classes.cpp [iso-8859-1] Sun Dec 18 22:56:13 2011 @@ -470,7 +470,10 @@
lResult = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszShellFolderKey, 0, KEY_READ, &hSFKey); if (lResult != ERROR_SUCCESS) - return FALSE; + { + ERR("Cannot open key: %ls\n", wszShellFolderKey); + return FALSE; + }
dwLen = sizeof(DWORD); lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen);
Modified: trunk/reactos/dll/win32/shell32/defcontextmenu.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/defcontex... ============================================================================== --- trunk/reactos/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/defcontextmenu.cpp [iso-8859-1] Sun Dec 18 22:56:13 2011 @@ -858,7 +858,6 @@ } }
- if (rfg & SFGAO_FILESYSTEM) { if (RegOpenKeyExW(HKEY_CLASSES_ROOT, L"AllFilesystemObjects", 0, KEY_READ, &hKey) == ERROR_SUCCESS) @@ -899,14 +898,12 @@ bAddSep = TRUE; }
- if (rfg & SFGAO_CANLINK) { bAddSep = FALSE; _InsertMenuItemW(hMenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0); _InsertMenuItemW(hMenu, indexMenu++, TRUE, FCIDM_SHVIEW_CREATELINK, MFT_STRING, MAKEINTRESOURCEW(IDS_CREATELINK), MFS_ENABLED); } -
if (rfg & SFGAO_CANDELETE) {
Modified: trunk/reactos/dll/win32/shell32/folders/desktop.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/d... ============================================================================== --- trunk/reactos/dll/win32/shell32/folders/desktop.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/desktop.cpp [iso-8859-1] Sun Dec 18 22:56:13 2011 @@ -546,8 +546,8 @@ 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 @@ 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 @@ /* 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; }
Modified: trunk/reactos/dll/win32/shell32/folders/recyclebin.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/r... ============================================================================== --- trunk/reactos/dll/win32/shell32/folders/recyclebin.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/folders/recyclebin.cpp [iso-8859-1] Sun Dec 18 22:56:13 2011 @@ -583,7 +583,7 @@ 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; }
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 Dec 18 22:56:13 2011 @@ -398,18 +398,18 @@ 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);