[2/5] msi: Pass the full custom action command to CreateProcess.

Alexandre Julliard julliard at winehq.org
Fri Jun 10 03:54:48 CDT 2011


Hans Leidekker <hans at codeweavers.com> writes:

> @@ -772,10 +772,22 @@ static HANDLE execute_command( const WCHAR *exe, WCHAR *arg, const WCHAR *dir )
>  {
>      STARTUPINFOW si;
>      PROCESS_INFORMATION info;
> +    int len;
> +    WCHAR *cmd;
>      BOOL ret;
>  
> +    len = strlenW( exe );
> +    if (arg) len += strlenW( arg ) + 1;
> +    if (!(cmd = msi_alloc( (len + 1) * sizeof(WCHAR) ))) return INVALID_HANDLE_VALUE;
> +    strcpyW( cmd, exe );
> +    if (arg)
> +    {
> +        strcatW( cmd, szSpace );
> +        strcatW( cmd, arg );
> +    }
>      memset( &si, 0, sizeof(STARTUPINFOW) );
> -    ret = CreateProcessW( exe, arg, NULL, NULL, FALSE, 0, NULL, dir, &si, &info );
> +    ret = CreateProcessW( NULL, cmd, NULL, NULL, FALSE, 0, NULL, dir, &si, &info );

You should still pass the exe name to CreateProcess in addition to the
command line. You probably also want to quote it in the command line if
it contains spaces. Also some callers pass a NULL exe.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list