[SHELL32] CFSFolder parsing must only apply bind data to the last item (#6794)

When IShellFolder::ParseDisplayName is asked to parse multiple path elements, the IFileSystemBindData (if any) only applies to the last item. The other elements are always folders.
This commit is contained in:
Whindmar Saksit 2024-05-02 18:00:12 +02:00 committed by GitHub
parent ef80b3dde4
commit 07d55ce1cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View file

@ -685,7 +685,7 @@ HRESULT SHELL32_GetFSItemAttributes(IShellFolder * psf, LPCITEMIDLIST pidl, LPDW
HRESULT CFSFolder::_ParseSimple(
_In_ LPOLESTR lpszDisplayName,
_Out_ WIN32_FIND_DATAW *pFind,
_Inout_ WIN32_FIND_DATAW *pFind,
_Out_ LPITEMIDLIST *ppidl)
{
HRESULT hr;
@ -693,6 +693,8 @@ HRESULT CFSFolder::_ParseSimple(
*ppidl = NULL;
const DWORD finalattr = pFind->dwFileAttributes;
const DWORD finalsizelo = pFind->nFileSizeLow;
LPITEMIDLIST pidl;
for (hr = S_OK; SUCCEEDED(hr); hr = SHILAppend(pidl, ppidl))
{
@ -700,9 +702,8 @@ HRESULT CFSFolder::_ParseSimple(
if (hr != S_OK)
break;
if (pchNext)
pFind->dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
pFind->dwFileAttributes = pchNext ? FILE_ATTRIBUTE_DIRECTORY : finalattr;
pFind->nFileSizeLow = pchNext ? 0 : finalsizelo;
pidl = _ILCreateFromFindDataW(pFind);
if (!pidl)
{

View file

@ -36,7 +36,7 @@ class CFSFolder :
HRESULT _ParseSimple(
_In_ LPOLESTR lpszDisplayName,
_Out_ WIN32_FIND_DATAW *pFind,
_Inout_ WIN32_FIND_DATAW *pFind,
_Out_ LPITEMIDLIST *ppidl);
BOOL _GetFindDataFromName(_In_ LPCWSTR pszName, _Out_ WIN32_FIND_DATAW *pFind);
HRESULT _CreateIDListFromName(LPCWSTR pszName, DWORD attrs, IBindCtx *pbc, LPITEMIDLIST *ppidl);