mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SHELL32] Forward CDefaultContextMenu::InvokeCommand parameters to ShellExecute (#7172)
This commit is contained in:
parent
876d1c2dc8
commit
d5aca44042
4 changed files with 17 additions and 9 deletions
|
@ -1302,6 +1302,9 @@ CDefaultContextMenu::TryToBrowse(
|
|||
HRESULT
|
||||
CDefaultContextMenu::InvokePidl(LPCMINVOKECOMMANDINFOEX lpcmi, LPCITEMIDLIST pidl, PStaticShellEntry pEntry)
|
||||
{
|
||||
BOOL unicode = lpcmi->cbSize >= FIELD_OFFSET(CMINVOKECOMMANDINFOEX, ptInvoke) &&
|
||||
(lpcmi->fMask & CMIC_MASK_UNICODE);
|
||||
|
||||
LPITEMIDLIST pidlFull = ILCombine(m_pidlFolder, pidl);
|
||||
if (pidlFull == NULL)
|
||||
{
|
||||
|
@ -1323,9 +1326,8 @@ CDefaultContextMenu::InvokePidl(LPCMINVOKECOMMANDINFOEX lpcmi, LPCITEMIDLIST pid
|
|||
*wszDir = UNICODE_NULL;
|
||||
}
|
||||
|
||||
SHELLEXECUTEINFOW sei;
|
||||
ZeroMemory(&sei, sizeof(sei));
|
||||
sei.cbSize = sizeof(sei);
|
||||
CComHeapPtr<WCHAR> pszParamsW;
|
||||
SHELLEXECUTEINFOW sei = { sizeof(sei) };
|
||||
sei.hwnd = lpcmi->hwnd;
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.lpVerb = pEntry->Verb;
|
||||
|
@ -1334,9 +1336,12 @@ CDefaultContextMenu::InvokePidl(LPCMINVOKECOMMANDINFOEX lpcmi, LPCITEMIDLIST pid
|
|||
sei.hkeyClass = pEntry->hkClass;
|
||||
sei.fMask = SEE_MASK_CLASSKEY | SEE_MASK_IDLIST;
|
||||
if (bHasPath)
|
||||
{
|
||||
sei.lpFile = wszPath;
|
||||
}
|
||||
|
||||
if (unicode && !StrIsNullOrEmpty(lpcmi->lpParametersW))
|
||||
sei.lpParameters = lpcmi->lpParametersW;
|
||||
else if (!StrIsNullOrEmpty(lpcmi->lpParameters) && __SHCloneStrAtoW(&pszParamsW, lpcmi->lpParameters))
|
||||
sei.lpParameters = pszParamsW;
|
||||
|
||||
ShellExecuteExW(&sei);
|
||||
|
||||
|
|
|
@ -2602,7 +2602,7 @@ HRESULT CShellLink::DoOpen(LPCMINVOKECOMMANDINFO lpici)
|
|||
if (unicode)
|
||||
{
|
||||
LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX)lpici;
|
||||
if (iciex->lpParametersW && iciex->lpParametersW[0])
|
||||
if (!StrIsNullOrEmpty(iciex->lpParametersW))
|
||||
{
|
||||
args += L' ';
|
||||
args += iciex->lpParametersW;
|
||||
|
@ -2611,7 +2611,7 @@ HRESULT CShellLink::DoOpen(LPCMINVOKECOMMANDINFO lpici)
|
|||
else
|
||||
{
|
||||
CComHeapPtr<WCHAR> pszParams;
|
||||
if (lpici->lpParameters && lpici->lpParameters[0] && __SHCloneStrAtoW(&pszParams, lpici->lpParameters))
|
||||
if (!StrIsNullOrEmpty(lpici->lpParameters) && __SHCloneStrAtoW(&pszParams, lpici->lpParameters))
|
||||
{
|
||||
args += L' ';
|
||||
args += pszParams;
|
||||
|
|
|
@ -1670,8 +1670,8 @@ static UINT_PTR SHELL_execute_class(LPCWSTR wszApplicationName, LPSHELLEXECUTEIN
|
|||
TRACE("SEE_MASK_CLASSNAME->%s, doc->%s\n", debugstr_w(execCmd), debugstr_w(wszApplicationName));
|
||||
|
||||
wcmd[0] = '\0';
|
||||
done = SHELL_ArgifyW(wcmd, ARRAY_SIZE(wcmd), execCmd, wszApplicationName, (LPITEMIDLIST)psei->lpIDList, NULL, &resultLen,
|
||||
(psei->lpDirectory && *psei->lpDirectory) ? psei->lpDirectory : NULL);
|
||||
done = SHELL_ArgifyW(wcmd, ARRAY_SIZE(wcmd), execCmd, wszApplicationName, (LPITEMIDLIST)psei->lpIDList, psei->lpParameters,
|
||||
&resultLen, (psei->lpDirectory && *psei->lpDirectory) ? psei->lpDirectory : NULL);
|
||||
if (!done && wszApplicationName[0])
|
||||
{
|
||||
strcatW(wcmd, L" ");
|
||||
|
|
|
@ -456,6 +456,9 @@ template<class B, class R> static HRESULT SHILCombine(B base, PCUIDLIST_RELATIVE
|
|||
return r ? S_OK : E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
static inline bool StrIsNullOrEmpty(LPCSTR str) { return !str || !*str; }
|
||||
static inline bool StrIsNullOrEmpty(LPCWSTR str) { return !str || !*str; }
|
||||
|
||||
HRESULT inline SHSetStrRet(LPSTRRET pStrRet, LPCSTR pstrValue)
|
||||
{
|
||||
pStrRet->uType = STRRET_CSTR;
|
||||
|
|
Loading…
Reference in a new issue