Author: gadamopoulos
Date: Mon Aug 17 15:34:02 2015
New Revision: 68744
URL:
http://svn.reactos.org/svn/reactos?rev=68744&view=rev
Log:
[SHELL32] - Use SHELL32_GetDisplayNameOfGUIDItem in CDesktopFolder
Modified:
trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp
Modified: trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/folders/…
==============================================================================
--- trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/folders/CDesktopFolder.cpp [iso-8859-1] Mon Aug 17
15:34:02 2015
@@ -650,6 +650,11 @@
if (!strRet)
return E_INVALIDARG;
+ if (_ILIsPidlSimple(pidl) && _ILIsSpecialFolder(pidl))
+ {
+ return SHELL32_GetDisplayNameOfGUIDItem(this, L"", pidl, dwFlags,
strRet);
+ }
+
pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
if (!pszPath)
return E_OUTOFMEMORY;
@@ -664,84 +669,28 @@
}
else if (_ILIsPidlSimple (pidl))
{
- GUID const *clsid;
-
- if ((clsid = _ILGetGUIDPointer (pidl)))
- {
- if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)
- {
- int bWantsForParsing;
-
- /*
- * We can only get a filesystem path from a shellfolder if the
- * value WantsFORPARSING in CLSID\\{...}\\shellfolder exists.
- *
- * Exception: The MyComputer folder doesn't have this key,
- * but any other filesystem backed folder it needs it.
- */
- if (IsEqualIID (*clsid, CLSID_MyComputer))
- {
- bWantsForParsing = TRUE;
- }
- else
- {
- /* get the "WantsFORPARSING" flag from the registry */
- static const WCHAR clsidW[] =
- { 'C', 'L', 'S', 'I', 'D',
'\\', 0 };
- static const WCHAR shellfolderW[] =
- { '\\', 's', 'h', 'e', 'l',
'l', 'f', 'o', 'l', 'd', 'e', 'r',
0 };
- static const WCHAR wantsForParsingW[] =
- { 'W', 'a', 'n', 't', 's',
'F', 'o', 'r', 'P', 'a', 'r', 's',
'i', 'n',
- 'g', 0
- };
- WCHAR szRegPath[100];
- LONG r;
-
- 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;
- else
- bWantsForParsing = FALSE;
- }
-
- 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
- {
- /* parsing name like ::{...} */
- pszPath[0] = ':';
- pszPath[1] = ':';
- SHELL32_GUIDToStringW (*clsid, &pszPath[2]);
- }
- }
- else
- {
- /* user friendly name */
- HCR_GetClassNameW (*clsid, pszPath, MAX_PATH);
- }
- }
- else
- {
- int cLen = 0;
-
- /* file system folder or file rooted at the desktop */
+ int cLen = 0;
+
+ /* file system folder or file rooted at the desktop */
+ if ((GET_SHGDN_FOR(dwFlags) == SHGDN_FORPARSING) &&
+ (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER))
+ {
+ lstrcpynW(pszPath, sPathTarget, MAX_PATH - 1);
+ PathAddBackslashW(pszPath);
+ cLen = wcslen(pszPath);
+ }
+
+ _ILSimpleGetTextW(pidl, pszPath + cLen, MAX_PATH - cLen);
+ if (!_ILIsFolder(pidl))
+ SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
+
+ if (GetFileAttributes(pszPath) == INVALID_FILE_ATTRIBUTES)
+ {
+ /* file system folder or file rooted at the AllUsers desktop */
if ((GET_SHGDN_FOR(dwFlags) == SHGDN_FORPARSING) &&
(GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER))
{
- lstrcpynW(pszPath, sPathTarget, MAX_PATH - 1);
+ SHGetSpecialFolderPathW(0, pszPath, CSIDL_COMMON_DESKTOPDIRECTORY,
FALSE);
PathAddBackslashW(pszPath);
cLen = wcslen(pszPath);
}
@@ -749,22 +698,6 @@
_ILSimpleGetTextW(pidl, pszPath + cLen, MAX_PATH - cLen);
if (!_ILIsFolder(pidl))
SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
-
- if (GetFileAttributes(pszPath) == INVALID_FILE_ATTRIBUTES)
- {
- /* file system folder or file rooted at the AllUsers desktop */
- if ((GET_SHGDN_FOR(dwFlags) == SHGDN_FORPARSING) &&
- (GET_SHGDN_RELATION(dwFlags) != SHGDN_INFOLDER))
- {
- SHGetSpecialFolderPathW(0, pszPath, CSIDL_COMMON_DESKTOPDIRECTORY,
FALSE);
- PathAddBackslashW(pszPath);
- cLen = wcslen(pszPath);
- }
-
- _ILSimpleGetTextW(pidl, pszPath + cLen, MAX_PATH - cLen);
- if (!_ILIsFolder(pidl))
- SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
- }
}
}
else