Fixed CreateProcessA so it can handle commandlines with arguments and
no .exe.
diff --git a/loader/module.c b/loader/module.c
index 9d1008e..52d18be 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -866,37 +866,22 @@
if ((pcmd = strchr(line, '"'))) /* closing '"' available, too ? */
len = ++pcmd - line;
}
-
- if (!len)
+ else
{
- p = strchr(line, ' ');
- do {
- len = (p? p-line : strlen(line)) + 1;
- if (len > namelen - 4) len = namelen - 4;
- lstrcpynA(name, line, len);
- if (extension && !strchr(name, '\\') && !strchr(name, '.'))
- strcat(name, ".exe");
- if (GetFileAttributesA(name) != -1) {
- pcmd = p ? p : line+strlen(line);
- break;
- }
- /* if there is a space and no file found yet, include the word
- * up to the next space too. If there is no next space, just
- * use the first word.
- */
- if (p) {
- p = strchr(p+1, ' ');
- } else {
- p = strchr(line, ' ');
- len = (p? p-line : strlen(line)) + 1;
- if (len > namelen - 4)
- len = namelen - 4;
- pcmd = p ? p + 1 : line+strlen(line);
- break;
- }
- } while (1);
+ if((p = strchr(line, ' ')))
+ {
+ len = p - line;
+ pcmd = p+1;
+ }
+ else
+ len = strlen(line);
+
+ len++;
}
+ if(len > (namelen - 4)) len = namelen - 4;
lstrcpynA(name, line, len);
+ if(extension && (strrchr(name, '.') <= strrchr(name, '\\')) )
+ strcat(name, ".exe");
if (after) *after = pcmd;
}
@@ -917,9 +902,6 @@
DWORD type;
char name[256];
LPCSTR cmdline;
-#if 0
- LPCSTR p = NULL;
-#endif
/* Get name and command line */
@@ -932,24 +914,15 @@
name[0] = '\0';
if (lpApplicationName) {
- get_executable_name( lpApplicationName, name, sizeof(name), NULL, FALSE);
-#if 0
- p = strrchr(name, '.');
- if (p >= name+strlen(name)-4) /* FIXME */
- *p = '\0';
-#endif
+ get_executable_name( lpApplicationName, name, sizeof(name), NULL, TRUE );
}
else {
- get_executable_name ( lpCommandLine, name, sizeof ( name ), NULL, FALSE );
+ get_executable_name( lpCommandLine, name, sizeof ( name ), NULL, TRUE );
}
if (!lpCommandLine)
cmdline = lpApplicationName;
else cmdline = lpCommandLine;
- if (!strchr(name, '\\') && !strchr(name, '.'))
- strcat(name, ".exe");
-
-
/* Warn if unsupported features are used */
if (dwCreationFlags & DEBUG_PROCESS)