Skip to content

Commit f335322

Browse files
authored
[SHELL32] SEE_MASK_IDLIST should not assume the PIDL is always a FS path (reactos#7693)
CORE-16898 CORE-14177
1 parent 6265add commit f335322

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

dll/win32/shell32/shlexec.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,18 +2076,25 @@ static BOOL SHELL_execute(LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc)
20762076
if (sei_tmp.fMask & SEE_MASK_IDLIST &&
20772077
(sei_tmp.fMask & SEE_MASK_INVOKEIDLIST) != SEE_MASK_INVOKEIDLIST)
20782078
{
2079-
CComPtr<IShellExecuteHookW> pSEH;
2080-
2081-
HRESULT hr = SHBindToParent((LPCITEMIDLIST)sei_tmp.lpIDList, IID_PPV_ARG(IShellExecuteHookW, &pSEH), NULL);
2079+
LPCITEMIDLIST pidl = (LPCITEMIDLIST)sei_tmp.lpIDList;
20822080

2081+
CComPtr<IShellExecuteHookW> pSEH;
2082+
HRESULT hr = SHBindToParent(pidl, IID_PPV_ARG(IShellExecuteHookW, &pSEH), NULL);
20832083
if (SUCCEEDED(hr))
20842084
{
20852085
hr = pSEH->Execute(&sei_tmp);
20862086
if (hr == S_OK)
20872087
return TRUE;
20882088
}
20892089

2090-
SHGetPathFromIDListW((LPCITEMIDLIST)sei_tmp.lpIDList, wszApplicationName);
2090+
hr = SHGetNameAndFlagsW(pidl, SHGDN_FORPARSING, wszApplicationName, dwApplicationNameLen, NULL);
2091+
if (FAILED(hr))
2092+
{
2093+
if (dwApplicationNameLen)
2094+
*wszApplicationName = UNICODE_NULL;
2095+
if (!_ILIsDesktop(pidl))
2096+
TRACE("Unable to get PIDL parsing path\n");
2097+
}
20912098
appKnownSingular = TRUE;
20922099
TRACE("-- idlist=%p (%s)\n", sei_tmp.lpIDList, debugstr_w(wszApplicationName));
20932100
}

0 commit comments

Comments
 (0)