When the wine loader invokes __wine_kernel_init, it expands the first command-line argument to its absolute path. If that expaned path contains certain characters, the lpCmdLine argument received by WinMain() may be mangled for some programs.
Similar to what PowerShell does, always use enclosing quotes on the first argument when constructing the process parameters' copy of the command line. This should only affect processes invoked using the wine loader.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47790 Signed-off-by: Jeff Smith whydoubt@gmail.com --- There are no tests for this patch, because it does not appear that the current framework tests the wine loader, and adding that testing would be quite the task of its own.
dlls/kernel32/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index d2682ac83e..c79ba7b1e1 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -987,7 +987,7 @@ static BOOL build_command_line( WCHAR **argv ) has_space=FALSE; bcount=0; a=*arg; - if( !*a ) has_space=TRUE; + if( arg == argv || !*a ) has_space=TRUE; while (*a!='\0') { if (*a=='\') { bcount++; @@ -1024,7 +1024,7 @@ static BOOL build_command_line( WCHAR **argv ) /* Check for quotes and spaces in this argument */ has_space=has_quote=FALSE; a=*arg; - if( !*a ) has_space=TRUE; + if( arg == argv || !*a ) has_space=TRUE; while (*a!='\0') { if (*a==' ' || *a=='\t') { has_space=TRUE;