mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 15:38:37 +00:00
[BROWSEUI][SHELL32] Fix shell path parsing (#7202)
Fix shell path parsing. JIRA issue: CORE-19693 JIRA issue: CORE-19694 - Fix CACListISF class by using PIDL attributes. - Use min macro instead of max macro in Shell_ParseSpecialFolder function.
This commit is contained in:
parent
960a305e5c
commit
ea936478f5
2 changed files with 16 additions and 6 deletions
|
@ -246,9 +246,15 @@ STDMETHODIMP CACListISF::Next(ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched)
|
||||||
if (!pszRawPath || !pszExpanded)
|
if (!pszRawPath || !pszExpanded)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((m_dwOptions & ACLO_FILESYSDIRS) && !PathIsDirectoryW(pszExpanded))
|
DWORD attrs = SFGAO_FOLDER | SFGAO_FILESYSTEM;
|
||||||
|
LPCITEMIDLIST pidlRef = pidlChild;
|
||||||
|
hr = m_pShellFolder->GetAttributesOf(1, &pidlRef, &attrs);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
continue;
|
continue;
|
||||||
else if ((m_dwOptions & ACLO_FILESYSONLY) && !PathFileExistsW(pszExpanded))
|
|
||||||
|
if ((m_dwOptions & ACLO_FILESYSDIRS) && !(attrs & SFGAO_FOLDER))
|
||||||
|
continue;
|
||||||
|
if ((m_dwOptions & (ACLO_FILESYSONLY | ACLO_FILESYSDIRS)) && !(attrs & SFGAO_FILESYSTEM))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
|
@ -339,12 +345,16 @@ STDMETHODIMP CACListISF::Expand(LPCOLESTR pszExpand)
|
||||||
{
|
{
|
||||||
if (PathIsRelativeW(pszExpand) &&
|
if (PathIsRelativeW(pszExpand) &&
|
||||||
SHGetPathFromIDListW(m_pidlCurDir, szPath1) &&
|
SHGetPathFromIDListW(m_pidlCurDir, szPath1) &&
|
||||||
PathCombineW(szPath2, szPath1, pszExpand))
|
PathCombineW(szPath2, szPath1, pszExpand) &&
|
||||||
|
PathFileExistsW(szPath2))
|
||||||
{
|
{
|
||||||
pszExpand = szPath2;
|
pszExpand = szPath2;
|
||||||
}
|
}
|
||||||
GetFullPathNameW(pszExpand, _countof(szPath1), szPath1, NULL);
|
else if (PathFileExistsW(pszExpand))
|
||||||
pszExpand = szPath1;
|
{
|
||||||
|
GetFullPathNameW(pszExpand, _countof(szPath1), szPath1, NULL);
|
||||||
|
pszExpand = szPath1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CComHeapPtr<ITEMIDLIST> pidl;
|
CComHeapPtr<ITEMIDLIST> pidl;
|
||||||
|
|
|
@ -1866,7 +1866,7 @@ INT Shell_ParseSpecialFolder(_In_ LPCWSTR pszStart, _Out_ LPWSTR *ppch, _Out_ IN
|
||||||
{
|
{
|
||||||
*ppch = (LPWSTR)(pchBackslash + 1);
|
*ppch = (LPWSTR)(pchBackslash + 1);
|
||||||
*pcch = (pchBackslash - pszStart) + 1;
|
*pcch = (pchBackslash - pszStart) + 1;
|
||||||
StrCpyNW(szPath, pszStart, max(*pcch, _countof(szPath)));
|
StrCpyNW(szPath, pszStart, min(*pcch, _countof(szPath)));
|
||||||
pszPath = szPath;
|
pszPath = szPath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue