mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SHELL32] Pass and expand .lnk working directory (#7314)
This commit is contained in:
parent
0707475f69
commit
a509941786
2 changed files with 13 additions and 3 deletions
|
@ -2617,9 +2617,11 @@ HRESULT CShellLink::DoOpen(LPCMINVOKECOMMANDINFO lpici)
|
|||
}
|
||||
}
|
||||
|
||||
WCHAR dir[MAX_PATH];
|
||||
SHELLEXECUTEINFOW sei = { sizeof(sei) };
|
||||
sei.fMask = SEE_MASK_HASLINKNAME | SEE_MASK_UNICODE |
|
||||
sei.fMask = SEE_MASK_HASLINKNAME | SEE_MASK_UNICODE | SEE_MASK_DOENVSUBST |
|
||||
(lpici->fMask & (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK | SEE_MASK_FLAG_NO_UI));
|
||||
sei.lpDirectory = m_sWorkDir;
|
||||
if (m_pPidl)
|
||||
{
|
||||
sei.lpIDList = m_pPidl;
|
||||
|
@ -2628,13 +2630,18 @@ HRESULT CShellLink::DoOpen(LPCMINVOKECOMMANDINFO lpici)
|
|||
else
|
||||
{
|
||||
sei.lpFile = m_sPath;
|
||||
if (!(m_Header.dwFlags & SLDF_HAS_EXP_SZ))
|
||||
{
|
||||
sei.fMask &= ~SEE_MASK_DOENVSUBST; // The link does not want to expand lpFile
|
||||
if (m_sWorkDir && ExpandEnvironmentStringsW(m_sWorkDir, dir, _countof(dir)) <= _countof(dir))
|
||||
sei.lpDirectory = dir;
|
||||
}
|
||||
}
|
||||
sei.lpParameters = args;
|
||||
sei.lpClass = m_sLinkPath;
|
||||
sei.nShow = m_Header.nShowCommand;
|
||||
if (lpici->nShow != SW_SHOWNORMAL && lpici->nShow != SW_SHOW)
|
||||
sei.nShow = lpici->nShow; // Allow invoker to override .lnk show mode
|
||||
sei.lpDirectory = m_sWorkDir;
|
||||
|
||||
return (ShellExecuteExW(&sei) ? S_OK : E_FAIL);
|
||||
}
|
||||
|
|
|
@ -1555,9 +1555,10 @@ static HRESULT ShellExecute_ContextMenuVerb(LPSHELLEXECUTEINFOW sei)
|
|||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
CComHeapPtr<char> verb, parameters;
|
||||
CComHeapPtr<char> verb, parameters, dir;
|
||||
__SHCloneStrWtoA(&verb, sei->lpVerb);
|
||||
__SHCloneStrWtoA(¶meters, sei->lpParameters);
|
||||
__SHCloneStrWtoA(&dir, sei->lpDirectory);
|
||||
|
||||
BOOL fDefault = StrIsNullOrEmpty(sei->lpVerb);
|
||||
CMINVOKECOMMANDINFOEX ici = { sizeof(ici) };
|
||||
|
@ -1571,6 +1572,8 @@ static HRESULT ShellExecute_ContextMenuVerb(LPSHELLEXECUTEINFOW sei)
|
|||
ici.hwnd = sei->hwnd;
|
||||
ici.lpParameters = parameters;
|
||||
ici.lpParametersW = sei->lpParameters;
|
||||
ici.lpDirectory = dir;
|
||||
ici.lpDirectoryW = sei->lpDirectory;
|
||||
ici.dwHotKey = sei->dwHotKey;
|
||||
ici.hIcon = sei->hIcon;
|
||||
if (ici.fMask & (CMIC_MASK_HASLINKNAME | CMIC_MASK_HASTITLE))
|
||||
|
|
Loading…
Reference in a new issue