mirror of
https://github.com/reactos/reactos.git
synced 2024-08-08 04:08:29 +00:00
[SHELL32] - Use SHELL32_GetDisplayNameOfGUIDItem in CDesktopFolder
svn path=/trunk/; revision=68744
This commit is contained in:
parent
46c7ef8191
commit
28e828a038
|
@ -650,6 +650,11 @@ HRESULT WINAPI CDesktopFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFl
|
||||||
if (!strRet)
|
if (!strRet)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
if (_ILIsPidlSimple(pidl) && _ILIsSpecialFolder(pidl))
|
||||||
|
{
|
||||||
|
return SHELL32_GetDisplayNameOfGUIDItem(this, L"", pidl, dwFlags, strRet);
|
||||||
|
}
|
||||||
|
|
||||||
pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
|
pszPath = (LPWSTR)CoTaskMemAlloc((MAX_PATH + 1) * sizeof(WCHAR));
|
||||||
if (!pszPath)
|
if (!pszPath)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -663,77 +668,6 @@ HRESULT WINAPI CDesktopFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFl
|
||||||
HCR_GetClassNameW(CLSID_ShellDesktop, pszPath, MAX_PATH);
|
HCR_GetClassNameW(CLSID_ShellDesktop, pszPath, MAX_PATH);
|
||||||
}
|
}
|
||||||
else if (_ILIsPidlSimple (pidl))
|
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;
|
int cLen = 0;
|
||||||
|
|
||||||
|
@ -766,7 +700,6 @@ HRESULT WINAPI CDesktopFolder::GetDisplayNameOf(PCUITEMID_CHILD pidl, DWORD dwFl
|
||||||
SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
|
SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* a complex pidl, let the subfolder do the work */
|
/* a complex pidl, let the subfolder do the work */
|
||||||
|
|
Loading…
Reference in a new issue