Fix CreateProcess to handle lpCommandline better.
This commit is contained in:
parent
aa546ef661
commit
4e5b11680f
|
@ -810,8 +810,11 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
|
||||||
HFILE hFile;
|
HFILE hFile;
|
||||||
OFSTRUCT ofs;
|
OFSTRUCT ofs;
|
||||||
DWORD type;
|
DWORD type;
|
||||||
char name[256], cmdline[256];
|
char name[256];
|
||||||
|
LPCSTR cmdline;
|
||||||
|
#if 0
|
||||||
LPCSTR p = NULL;
|
LPCSTR p = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Get name and command line */
|
/* Get name and command line */
|
||||||
|
|
||||||
|
@ -822,26 +825,21 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
|
||||||
}
|
}
|
||||||
|
|
||||||
name[0] = '\0';
|
name[0] = '\0';
|
||||||
cmdline[0] = '\0';
|
|
||||||
|
|
||||||
if (lpApplicationName) {
|
if (lpApplicationName) {
|
||||||
get_executable_name( lpApplicationName, name, sizeof(name), NULL, FALSE);
|
get_executable_name( lpApplicationName, name, sizeof(name), NULL, FALSE);
|
||||||
strcpy(cmdline, name);
|
|
||||||
#if 0
|
#if 0
|
||||||
p = strrchr(name, '.');
|
p = strrchr(name, '.');
|
||||||
if (p >= name+strlen(name)-4) /* FIXME */
|
if (p >= name+strlen(name)-4) /* FIXME */
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (lpCommandLine)
|
else {
|
||||||
if (strlen(name)) {
|
get_executable_name ( lpCommandLine, name, sizeof ( name ), NULL, FALSE );
|
||||||
get_executable_name(lpCommandLine, cmdline, sizeof(cmdline), &p, TRUE);
|
}
|
||||||
strcat(cmdline, p);
|
if (!lpCommandLine)
|
||||||
} else {
|
cmdline = lpApplicationName;
|
||||||
get_executable_name(lpCommandLine, name, sizeof(name), &p, TRUE);
|
else cmdline = lpCommandLine;
|
||||||
strcpy(cmdline, name);
|
|
||||||
strcat(cmdline, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strchr(name, '\\') && !strchr(name, '.'))
|
if (!strchr(name, '\\') && !strchr(name, '.'))
|
||||||
strcat(name, ".exe");
|
strcat(name, ".exe");
|
||||||
|
|
Loading…
Reference in New Issue