Author: gadamopoulos
Date: Mon Aug 17 11:41:15 2015
New Revision: 68730
URL:
http://svn.reactos.org/svn/reactos?rev=68730&view=rev
Log:
[SHELL32]
- Use SHELL32_GetGuidItemAttributes, SHELL32_GetFSItemAttributes, SHELL32_BindToGuidItem
and SHELL32_GetDisplayNameOfGUIDItem in CControlPanelFolder, CDrivesFolder and CFSFolder
instead of using functions that accept all sorts of pidl types.
Modified:
trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp
trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp
trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp
Modified: trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp [iso-8859-1]
(original)
+++ trunk/reactos/dll/win32/shell32/folders/CControlPanelFolder.cpp [iso-8859-1] Mon Aug
17 11:41:15 2015
@@ -388,9 +388,7 @@
REFIID riid,
LPVOID *ppvOut)
{
- TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this, pidl, pbcReserved,
shdebugstr_guid(&riid), ppvOut);
-
- return SHELL32_BindToChild(pidlRoot, NULL, pidl, riid, ppvOut);
+ return SHELL32_BindToGuidItem(pidlRoot, pidl, pbcReserved, riid, ppvOut);
}
/**************************************************************************
@@ -484,7 +482,7 @@
if (_ILIsCPanelStruct(*apidl))
*rgfInOut &= SFGAO_CANLINK;
else if (_ILIsSpecialFolder(*apidl))
- SHELL32_GetItemAttributes(this, *apidl, rgfInOut);
+ SHELL32_GetGuidItemAttributes(this, *apidl, rgfInOut);
else
ERR("Got an unkown pidl here!\n");
apidl++;
@@ -574,69 +572,24 @@
*/
HRESULT WINAPI CControlPanelFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFlags,
LPSTRRET strRet)
{
- CHAR szName[MAX_PATH];
- WCHAR wszName[MAX_PATH+1]; /* +1 for potential backslash */
- PIDLCPanelStruct *pCPanel;
- HRESULT hr;
-
- *szName = '\0';
-
- TRACE("(%p)->(pidl=%p,0x%08x,%p)\n", this, pidl, dwFlags, strRet);
- pdump(pidl);
-
if (!pidl)
return S_FALSE;
- pCPanel = _ILGetCPanelPointer(pidl);
+ PIDLCPanelStruct *pCPanel = _ILGetCPanelPointer(pidl);
if (pCPanel)
{
/* copy display name from pidl - it was retrived from applet before;
SHGDN_FORPARSING does not need special handling */
- lstrcpyA(szName, pCPanel->szName + pCPanel->offsDispName);
- }
- /* take names of special folders only if it's only this folder */
+ strRet->uType = STRRET_CSTR;
+ lstrcpyA(strRet->cStr, pCPanel->szName + pCPanel->offsDispName);
+ }
else if (_ILIsSpecialFolder(pidl))
{
- BOOL bSimplePidl = _ILIsPidlSimple(pidl);
- SFGAOF Attr = SFGAO_FILESYSTEM;
-
- SHELL32_GetItemAttributes(this, pidl, &Attr);
- if (Attr & SFGAO_FILESYSTEM)
- {
- hr = SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, wszName,
sizeof(wszName));
- if (FAILED(hr))
- return hr;
- }
- else if (bSimplePidl)
- {
- _ILSimpleGetTextW(pidl, wszName, MAX_PATH); /* append my own path */
- }
- else
- {
- FIXME("special pidl\n");
- if (dwFlags & SHGDN_FORPARSING)
- {
- /* go deeper if needed */
- int cchName;
-
- PathAddBackslashW(wszName);
- cchName = wcslen(wszName);
-
- hr = SHELL32_GetDisplayNameOfChild(this, pidl, dwFlags, wszName +
cchName, MAX_PATH + 1 - cchName);
- if (FAILED(hr))
- return hr;
- }
- }
-
- if (!WideCharToMultiByte(CP_ACP, 0, wszName, -1, szName, MAX_PATH, NULL, NULL))
- szName[0] = '\0';
- }
-
- strRet->uType = STRRET_CSTR;
- lstrcpynA(strRet->cStr, szName, MAX_PATH);
-
- TRACE("--(%p)->(%s)\n", this, szName);
+ static const WCHAR* pszCPanelPath =
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}";
+ return SHELL32_GetDisplayNameOfGUIDItem(this, pszCPanelPath, pidl, dwFlags,
strRet);
+ }
+
return S_OK;
}
Modified: trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CDrivesFolder.cpp [iso-8859-1] Mon Aug 17
11:41:15 2015
@@ -263,6 +263,9 @@
TRACE("(%p)->(pidl=%p,%p,%s,%p)\n", this,
pidl, pbcReserved, shdebugstr_guid(&riid), ppvOut);
+ if (_ILIsSpecialFolder(pidl))
+ return SHELL32_BindToGuidItem(pidlRoot, pidl, pbcReserved, riid, ppvOut);
+
return SHELL32_BindToChild(pidlRoot, NULL, pidl, riid, ppvOut);
}
@@ -376,7 +379,7 @@
else if (_ILIsControlPanel(apidl[i]))
*rgfInOut &= dwControlPanelAttributes;
else if (_ILIsSpecialFolder(*apidl))
- SHELL32_GetItemAttributes(this, apidl[i], rgfInOut);
+ SHELL32_GetGuidItemAttributes(this, apidl[i], rgfInOut);
else
ERR("Got unknown pidl type!\n");
}
@@ -493,91 +496,10 @@
}
else if (_ILIsPidlSimple(pidl))
{
- /* take names of special folders only if its only this folder */
if (_ILIsSpecialFolder(pidl))
- {
- GUID const *clsid;
-
- clsid = _ILGetGUIDPointer (pidl);
- if (clsid)
- {
- if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)
- {
- static const WCHAR clsidW[] = L"CLSID\\";
- static const WCHAR shellfolderW[] = L"\\shellfolder";
- static const WCHAR wantsForParsingW[] =
L"WantsForParsing";
- BOOL bWantsForParsing = FALSE;
- WCHAR szRegPath[100];
- LONG r;
-
- /*
- * We can only get a filesystem path from a shellfolder
- * if the value WantsFORPARSING exists in
- * CLSID\\{...}\\shellfolder
- * exception: the MyComputer folder has this keys not
- * but like any filesystem backed
- * folder it needs these behaviour
- *
- * Get the "WantsFORPARSING" flag from the registry
- */
-
- wcscpy(szRegPath, clsidW);
- SHELL32_GUIDToStringW(*clsid, &szRegPath[6]);
- wcscat(szRegPath, shellfolderW);
- r = SHGetValueW(HKEY_CLASSES_ROOT, szRegPath,
- wantsForParsingW, NULL, NULL, NULL);
- if (r == ERROR_SUCCESS)
- bWantsForParsing = TRUE;
-
- if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
- bWantsForParsing)
- {
- /*
- * We need the filesystem path to the destination folder
- * Only the folder itself can know it
- */
- hr = SHELL32_GetDisplayNameOfChild (this, pidl,
- dwFlags, pszPath, MAX_PATH);
- }
- else
- {
- LPWSTR p = pszPath;
-
- /* parsing name like ::{...} */
- p[0] = ':';
- p[1] = ':';
- p += 2;
- p += SHELL32_GUIDToStringW(CLSID_MyComputer, p);
-
- /* \:: */
- p[0] = '\\';
- p[1] = ':';
- p[2] = ':';
- p += 3;
- SHELL32_GUIDToStringW(*clsid, p);
- }
- }
- else
- {
- /* user friendly name */
-
- if (_ILIsMyComputer(pidl) && sName)
- wcscpy(pszPath, sName);
- else
- HCR_GetClassNameW (*clsid, pszPath, MAX_PATH);
-
- TRACE("pszPath %s\n", debugstr_w(pszPath));
- }
- }
- else
- {
- /* append my own path */
- _ILSimpleGetTextW(pidl, pszPath, MAX_PATH);
- }
- }
+ return SHELL32_GetDisplayNameOfGUIDItem(this,
L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}", pidl, dwFlags, strRet);
else if (_ILIsDrive(pidl))
{
-
_ILSimpleGetTextW(pidl, pszPath, MAX_PATH); /* append my own path */
/* long view "lw_name (C:)" */
if (!(dwFlags & SHGDN_FORPARSING))
Modified: trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CFSFolder.cpp [iso-8859-1] Mon Aug 17 11:41:15
2015
@@ -233,7 +233,7 @@
{
/* it's the last element */
if (pdwAttributes && *pdwAttributes)
- hr = SHELL32_GetItemAttributes(this, pidlTemp, pdwAttributes);
+ hr = SHELL32_GetFSItemAttributes(this, pidlTemp, pdwAttributes);
}
}
}
@@ -369,12 +369,6 @@
PCUITEMID_CHILD_ARRAY apidl, DWORD * rgfInOut)
{
HRESULT hr = S_OK;
- static const DWORD dwDriveAttributes =
- SFGAO_HASSUBFOLDER | SFGAO_FILESYSTEM | SFGAO_FOLDER | SFGAO_FILESYSANCESTOR |
- SFGAO_DROPTARGET | SFGAO_HASPROPSHEET | SFGAO_CANRENAME | SFGAO_CANLINK;
-
- TRACE("(%p)->(cidl=%d apidl=%p mask=%p (0x%08x))\n", this, cidl, apidl,
- rgfInOut, rgfInOut ? *rgfInOut : 0);
if (!rgfInOut)
return E_INVALIDARG;
@@ -386,20 +380,25 @@
if(cidl == 0)
{
- IShellFolder *psfParent = NULL;
- LPCITEMIDLIST rpidl = NULL;
-
- hr = SHBindToParent(pidlRoot, IID_PPV_ARG(IShellFolder, &psfParent),
&rpidl);
- if(SUCCEEDED(hr))
- {
- if (_ILIsDrive(rpidl))
- *rgfInOut &= dwDriveAttributes;
- if (_ILIsFolder(rpidl) || _ILIsValue(rpidl))
- SHELL32_GetItemAttributes(this, rpidl, rgfInOut);
- else
- ERR("Got an unknown type of pidl!!!\n");
-
- psfParent->Release();
+ LPCITEMIDLIST rpidl = ILFindLastID(pidlRoot);
+
+ if (_ILIsFolder(rpidl) || _ILIsValue(rpidl))
+ {
+ SHELL32_GetFSItemAttributes(this, rpidl, rgfInOut);
+ }
+ else if (_ILIsDrive(rpidl))
+ {
+ IShellFolder *psfParent = NULL;
+ hr = SHBindToParent(pidlRoot, IID_PPV_ARG(IShellFolder, &psfParent),
NULL);
+ if(SUCCEEDED(hr))
+ {
+ hr = psfParent->GetAttributesOf(1, &rpidl, (SFGAOF*)rgfInOut);
+ psfParent->Release();
+ }
+ }
+ else
+ {
+ DPRINT1("Got and unknown pidl!\n");
}
}
else
@@ -408,7 +407,7 @@
{
pdump(*apidl);
if(_ILIsFolder(*apidl) || _ILIsValue(*apidl))
- SHELL32_GetItemAttributes(this, *apidl, rgfInOut);
+ SHELL32_GetFSItemAttributes(this, *apidl, rgfInOut);
else
ERR("Got an unknown type of pidl!!!\n");
apidl++;