Module: wine Branch: refs/heads/master Commit: 68df9182825ee82793bc8fb76dd0ae7409fbd384 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=68df9182825ee82793bc8fb7...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Dec 19 21:25:23 2005 +0100
kernel32: Check for tabs too when extracting the program name (reported by Vitaliy Margolen).
---
dlls/kernel/process.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c index e75fccb..19d945b 100644 --- a/dlls/kernel/process.c +++ b/dlls/kernel/process.c @@ -1736,6 +1736,7 @@ static LPWSTR get_file_name( LPCWSTR app
WCHAR *name, *pos, *ret = NULL; const WCHAR *p; + BOOL got_space;
/* if we have an app name, everything is easy */
@@ -1780,26 +1781,27 @@ static LPWSTR get_file_name( LPCWSTR app return NULL; pos = name; p = cmdline; + got_space = FALSE;
while (*p) { - do *pos++ = *p++; while (*p && *p != ' '); + do *pos++ = *p++; while (*p && *p != ' ' && *p != '\t'); *pos = 0; if (find_exe_file( name, buffer, buflen, handle )) { ret = cmdline; break; } + if (*p) got_space = TRUE; }
- if (!ret || !strchrW( name, ' ' )) goto done; /* no change necessary */ - - /* now build a new command-line with quotes */ - - if (!(ret = HeapAlloc( GetProcessHeap(), 0, (strlenW(cmdline) + 3) * sizeof(WCHAR) ))) - goto done; - sprintfW( ret, quotesW, name ); - strcatW( ret, p ); + if (ret && got_space) /* now build a new command-line with quotes */ + { + if (!(ret = HeapAlloc( GetProcessHeap(), 0, (strlenW(cmdline) + 3) * sizeof(WCHAR) ))) + goto done; + sprintfW( ret, quotesW, name ); + strcatW( ret, p ); + }
done: HeapFree( GetProcessHeap(), 0, name );