mirror of
https://github.com/reactos/reactos.git
synced 2025-04-09 23:37:40 +00:00
[COMDLG32] Differentiate between real and virtual folders,
do not allow traversal inside virtual folders when selecting a file CORE-16908
This commit is contained in:
parent
8451389041
commit
332889b8d7
2 changed files with 6 additions and 6 deletions
|
@ -2782,12 +2782,12 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf,
|
|||
PathAddBackslashW(lpwstrTemp);
|
||||
}
|
||||
|
||||
dwAttributes = SFGAO_FOLDER;
|
||||
dwAttributes = SFGAO_FOLDER | SFGAO_FILESYSANCESTOR;
|
||||
if(SUCCEEDED(IShellFolder_ParseDisplayName(*ppsf, hwnd, NULL, lpwstrTemp, &dwEaten, &pidl, &dwAttributes)))
|
||||
{
|
||||
/* the path component is valid, we have a pidl of the next path component */
|
||||
TRACE("parse OK attr=0x%08x pidl=%p\n", dwAttributes, pidl);
|
||||
if(dwAttributes & SFGAO_FOLDER)
|
||||
if((dwAttributes & (SFGAO_FOLDER | SFGAO_FILESYSANCESTOR)) == (SFGAO_FOLDER | SFGAO_FILESYSANCESTOR))
|
||||
{
|
||||
if(FAILED(IShellFolder_BindToObject(*ppsf, pidl, 0, &IID_IShellFolder, (LPVOID*)&lpsfChild)))
|
||||
{
|
||||
|
@ -4468,7 +4468,7 @@ static LPITEMIDLIST GetPidlFromName(IShellFolder *lpsf,LPWSTR lpcstrFileName)
|
|||
*/
|
||||
static BOOL IsPidlFolder (LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
|
||||
{
|
||||
ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
|
||||
ULONG uAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR;
|
||||
HRESULT ret;
|
||||
|
||||
TRACE("%p, %p\n", psf, pidl);
|
||||
|
@ -4477,7 +4477,7 @@ static BOOL IsPidlFolder (LPSHELLFOLDER psf, LPCITEMIDLIST pidl)
|
|||
|
||||
TRACE("-- 0x%08x 0x%08x\n", uAttr, ret);
|
||||
/* see documentation shell 4.1*/
|
||||
return uAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER);
|
||||
return (uAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER)) && (uAttr & SFGAO_FILESYSANCESTOR);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -774,9 +774,9 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDl
|
|||
{
|
||||
HRESULT hRes;
|
||||
|
||||
ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER;
|
||||
ULONG ulAttr = SFGAO_FOLDER | SFGAO_HASSUBFOLDER | SFGAO_FILESYSANCESTOR;
|
||||
IShellFolder_GetAttributesOf(fodInfos->Shell.FOIShellFolder, 1, (LPCITEMIDLIST *)&pidl, &ulAttr);
|
||||
if (ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER) )
|
||||
if ((ulAttr & (SFGAO_FOLDER | SFGAO_HASSUBFOLDER)) && (ulAttr & SFGAO_FILESYSANCESTOR))
|
||||
{
|
||||
hRes = IShellBrowser_BrowseObject(&This->IShellBrowser_iface,pidl,SBSP_RELATIVE);
|
||||
if(fodInfos->ofnInfos->Flags & OFN_EXPLORER)
|
||||
|
|
Loading…
Reference in a new issue