https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3263303844bd1b8f622e2…
commit 3263303844bd1b8f622e2366e1a5538accb6f5eb
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Tue Feb 20 16:59:00 2018 +0200
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Tue Feb 20 16:59:00 2018 +0200
[SHELL32] CShellItem: Fix GetDisplayName and Compare
The two methods were completely broken because they passed a full pidl to the parent
folder (and not desktop folder).
Compile SHGetNameFromIDList to use it in CShellItem but don't export it.
---
dll/win32/shell32/CShellItem.cpp | 55 ++++------------------------------------
dll/win32/shell32/wine/pidl.c | 4 +--
2 files changed, 7 insertions(+), 52 deletions(-)
diff --git a/dll/win32/shell32/CShellItem.cpp b/dll/win32/shell32/CShellItem.cpp
index f0a6ee650a..d403adcf02 100644
--- a/dll/win32/shell32/CShellItem.cpp
+++ b/dll/win32/shell32/CShellItem.cpp
@@ -159,52 +159,7 @@ HRESULT WINAPI CShellItem::GetParent(IShellItem **ppsi)
HRESULT WINAPI CShellItem::GetDisplayName(SIGDN sigdnName, LPWSTR *ppszName)
{
- HRESULT hr;
- CComPtr<IShellFolder> parent_folder;
- STRRET name;
- DWORD uFlags;
-
- TRACE("(%p,%x,%p)\n", this, sigdnName, ppszName);
-
- if (sigdnName & SIGDN_URL)
- return E_NOTIMPL;
-
- if (ppszName == NULL)
- return E_POINTER;
-
- *ppszName = NULL;
-
- hr = get_parent_shellfolder(&parent_folder);
- if (SUCCEEDED(hr))
- {
- switch (sigdnName)
- {
- case SIGDN_PARENTRELATIVEEDITING:
- uFlags = SHGDN_FOREDITING | SHGDN_INFOLDER;
- break;
- case SIGDN_DESKTOPABSOLUTEEDITING:
- uFlags = SHGDN_FOREDITING;
- break;
- case SIGDN_PARENTRELATIVEPARSING:
- uFlags = SHGDN_FORPARSING | SHGDN_INFOLDER;
- break;
- case SIGDN_DESKTOPABSOLUTEPARSING:
- uFlags = SHGDN_FORPARSING;
- break;
- default:
- uFlags = SHGDN_NORMAL;
- break;
- }
-
- hr = parent_folder->GetDisplayNameOf(m_pidl, uFlags, &name);
- if (SUCCEEDED(hr))
- {
- StrRetToStrW(&name, m_pidl, ppszName);
- return S_OK;
- }
- }
-
- return hr;
+ return SHGetNameFromIDList(m_pidl, sigdnName, ppszName);
}
HRESULT WINAPI CShellItem::GetAttributes(SFGAOF sfgaoMask, SFGAOF *psfgaoAttribs)
@@ -237,7 +192,7 @@ HRESULT WINAPI CShellItem::Compare(IShellItem *oth, SICHINTF hint, int
*piOrder)
{
HRESULT hr;
CComPtr<IPersistIDList> pIDList;
- CComPtr<IShellFolder> parent_folder;
+ CComPtr<IShellFolder> psfDesktop;
LPITEMIDLIST pidl;
TRACE("(%p,%p,%x,%p)\n", this, oth, hint, piOrder);
@@ -251,11 +206,11 @@ HRESULT WINAPI CShellItem::Compare(IShellItem *oth, SICHINTF hint,
int *piOrder)
hr = pIDList->GetIDList(&pidl);
if (SUCCEEDED(hr))
{
- hr = get_parent_shellfolder(&parent_folder);
+ hr = SHGetDesktopFolder(&psfDesktop);
if (SUCCEEDED(hr))
{
- hr = parent_folder->CompareIDs(hint, m_pidl, pidl);
- *piOrder = static_cast<int>(SCODE_CODE(hr));
+ hr = psfDesktop->CompareIDs(hint, m_pidl, pidl);
+ *piOrder = (int)(short)SCODE_CODE(hr);
}
ILFree(pidl);
}
diff --git a/dll/win32/shell32/wine/pidl.c b/dll/win32/shell32/wine/pidl.c
index 15faf04981..4f917e1629 100644
--- a/dll/win32/shell32/wine/pidl.c
+++ b/dll/win32/shell32/wine/pidl.c
@@ -1403,8 +1403,6 @@ HRESULT WINAPI SHParseDisplayName(LPCWSTR pszName, IBindCtx *pbc,
return hr;
}
-#ifndef __REACTOS__
-
/*************************************************************************
* SHGetNameFromIDList [SHELL32.@]
*/
@@ -1466,6 +1464,8 @@ HRESULT WINAPI SHGetNameFromIDList(PCIDLIST_ABSOLUTE pidl, SIGDN
sigdnName, PWST
return ret;
}
+#ifndef __REACTOS__
+
/*************************************************************************
* SHGetIDListFromObject [SHELL32.@]
*/