[SHELL32]

Implement the usage of the STARTF_TITLEISLINKNAME flag (in a STARTUPINFO structure, it signals that the program was started from a shell link, and therefore its lpTitle member holds the path of the link).
What I do is that, in CShellLink::InvokeCommand (called when a shortcut is being executed), I initialize the SHELLEXECUTEINFO structure such that we know that we are starting from a shortcut (use the
SEE_MASK_HASLINKNAME flag), and to hold the path to the flag I use its lpClass member (which is not used for other things in this code path). Then the whole thing is passed to ShellExecuteExW which, in turn,
calls the SHELL_ExecuteW function. This function reads the SHELLEXECUTEINFO structure and, if it has the flag SEE_MASK_HASLINKNAME (or SEE_MASK_HASTITLE too, if somebody also uses lpClass to pass a particular
title for the startup), we use the forementioned lpClass member, holding the link path, as the title (lpTitle member) of a new STARTUPINFO object used when calling CreateProcess (and thus, launching the
new application). So that this application will be aware that she was launched via a link (therefore we become compliant with the STARTF_TITLEISLINKNAME documentation).

svn path=/branches/ros-csrss/; revision=58480
This commit is contained in:
Hermès Bélusca-Maïto 2013-03-13 01:35:46 +00:00
parent 17c0fa64de
commit 471be3e868
3 changed files with 15 additions and 8 deletions

View file

@ -1825,10 +1825,10 @@ HRESULT WINAPI CShellLink::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
else
path = strdupW(sPath);
if (lpici->cbSize == sizeof (CMINVOKECOMMANDINFOEX) &&
(lpici->fMask & CMIC_MASK_UNICODE))
if ( lpici->cbSize == sizeof(CMINVOKECOMMANDINFOEX) &&
(lpici->fMask & CMIC_MASK_UNICODE) )
{
LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX) lpici;
LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX)lpici;
DWORD len = 2;
if (sArgs)
@ -1854,8 +1854,10 @@ HRESULT WINAPI CShellLink::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
SHELLEXECUTEINFOW sei;
memset(&sei, 0, sizeof sei);
sei.cbSize = sizeof sei;
sei.fMask = SEE_MASK_UNICODE | (lpici->fMask & (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK | SEE_MASK_FLAG_NO_UI));
sei.fMask = SEE_MASK_HASLINKNAME | SEE_MASK_UNICODE |
(lpici->fMask & (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK | SEE_MASK_FLAG_NO_UI));
sei.lpFile = path;
sei.lpClass = sLinkPath;
sei.nShow = iShowCmd;
sei.lpDirectory = sWorkDir;
sei.lpParameters = args;

View file

@ -67,11 +67,11 @@ private:
LPWSTR sWorkDir;
LPWSTR sDescription;
LPWSTR sPathRel;
LPWSTR sProduct;
LPWSTR sComponent;
LPWSTR sProduct;
LPWSTR sComponent;
volume_info volume;
LPWSTR sLinkPath;
BOOL bRunAs;
LPWSTR sLinkPath;
BOOL bRunAs;
BOOL bDirty;
INT iIdOpen; /* id of the "Open" entry in the context menu */
CComPtr<IUnknown> site;

View file

@ -450,6 +450,11 @@ static UINT_PTR SHELL_ExecuteW(const WCHAR *lpCmd, WCHAR *env, BOOL shWait,
startup.cb = sizeof(STARTUPINFOW);
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = psei->nShow;
startup.lpTitle = (LPWSTR)(psei->fMask & (SEE_MASK_HASLINKNAME | SEE_MASK_HASTITLE) ? psei->lpClass : NULL);
if (psei->fMask & SEE_MASK_HASLINKNAME)
startup.dwFlags |= STARTF_TITLEISLINKNAME;
dwCreationFlags = CREATE_UNICODE_ENVIRONMENT;
if (psei->fMask & SEE_MASK_NO_CONSOLE)