Pass the correct verb.

Add a space between extra parameters.
Wait for ShellExecute to complete.
This commit is contained in:
Mike McCormack 2005-11-03 09:55:21 +00:00 committed by Alexandre Julliard
parent 20ea04f976
commit 0de1f3e629
1 changed files with 15 additions and 1 deletions

View File

@ -2466,6 +2466,7 @@ static HRESULT WINAPI
ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici ) ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici )
{ {
IShellLinkImpl *This = impl_from_IContextMenu(iface); IShellLinkImpl *This = impl_from_IContextMenu(iface);
static const WCHAR szOpen[] = { 'O','p','e','n',0 };
SHELLEXECUTEINFOW sei; SHELLEXECUTEINFOW sei;
HWND hwnd = NULL; /* FIXME: get using interface set from IObjectWithSite */ HWND hwnd = NULL; /* FIXME: get using interface set from IObjectWithSite */
LPWSTR args = NULL; LPWSTR args = NULL;
@ -2500,7 +2501,7 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici )
( lpici->fMask & CMIC_MASK_UNICODE ) ) ( lpici->fMask & CMIC_MASK_UNICODE ) )
{ {
LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX) lpici; LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX) lpici;
DWORD len = 0; DWORD len = 2;
if ( This->sArgs ) if ( This->sArgs )
len += lstrlenW( This->sArgs ); len += lstrlenW( This->sArgs );
@ -2512,19 +2513,32 @@ ShellLink_InvokeCommand( IContextMenu* iface, LPCMINVOKECOMMANDINFO lpici )
if ( This->sArgs ) if ( This->sArgs )
lstrcatW( args, This->sArgs ); lstrcatW( args, This->sArgs );
if ( iciex->lpParametersW ) if ( iciex->lpParametersW )
{
static const WCHAR space[] = { ' ', 0 };
lstrcatW( args, space );
lstrcatW( args, iciex->lpParametersW ); lstrcatW( args, iciex->lpParametersW );
}
} }
memset( &sei, 0, sizeof sei ); memset( &sei, 0, sizeof sei );
sei.cbSize = sizeof sei; sei.cbSize = sizeof sei;
sei.fMask = SEE_MASK_UNICODE | SEE_MASK_NOCLOSEPROCESS;
sei.lpFile = path; sei.lpFile = path;
sei.nShow = This->iShowCmd; sei.nShow = This->iShowCmd;
sei.lpIDList = This->pPidl; sei.lpIDList = This->pPidl;
sei.lpDirectory = This->sWorkDir; sei.lpDirectory = This->sWorkDir;
sei.lpParameters = args; sei.lpParameters = args;
sei.lpVerb = szOpen;
if( ShellExecuteExW( &sei ) ) if( ShellExecuteExW( &sei ) )
{
if ( sei.hProcess )
{
WaitForSingleObject( sei.hProcess, 10000 );
CloseHandle( sei.hProcess );
}
r = S_OK; r = S_OK;
}
else else
r = E_FAIL; r = E_FAIL;