Fix CreateProcess("c:\Program Files\hello.bat").

This commit is contained in:
Francois Gouget 2003-05-19 23:16:12 +00:00 committed by Alexandre Julliard
parent b367a6e628
commit 8458040172
1 changed files with 3 additions and 4 deletions

View File

@ -1264,12 +1264,11 @@ BOOL WINAPI CreateProcessA( LPCSTR app_name, LPSTR cmd_line, LPSECURITY_ATTRIBUT
char comspec[MAX_PATH]; char comspec[MAX_PATH];
if (GetEnvironmentVariableA("COMSPEC", comspec, sizeof(comspec))) if (GetEnvironmentVariableA("COMSPEC", comspec, sizeof(comspec)))
{ {
char *newcmdline, *q = strchr(cmd_line, ' '); char *newcmdline;
if (!q) q = "";
if ((newcmdline = HeapAlloc( GetProcessHeap(), 0, if ((newcmdline = HeapAlloc( GetProcessHeap(), 0,
strlen(comspec) + strlen(name) + strlen(q) + 8))) strlen(comspec) + 4 + strlen(tidy_cmdline) + 1)))
{ {
sprintf( newcmdline, "%s /c %s%s", comspec, name, q ); sprintf( newcmdline, "%s /c %s", comspec, tidy_cmdline);
TRACE( "starting %s as batch binary: %s\n", TRACE( "starting %s as batch binary: %s\n",
debugstr_a(name), debugstr_a(newcmdline) ); debugstr_a(name), debugstr_a(newcmdline) );
retv = CreateProcessA( comspec, newcmdline, process_attr, thread_attr, retv = CreateProcessA( comspec, newcmdline, process_attr, thread_attr,