From 4e5b11680f83065f7b38c86a7430dba972148311 Mon Sep 17 00:00:00 2001
From: Peter Ganten <ganten@uni-bremen.de>
Date: Sat, 13 Mar 1999 17:05:39 +0000
Subject: [PATCH] Fix CreateProcess to handle lpCommandline better.

---
 loader/module.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/loader/module.c b/loader/module.c
index 75c4413388c..666d3c06a91 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -810,8 +810,11 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
     HFILE hFile;
     OFSTRUCT ofs;
     DWORD type;
-    char name[256], cmdline[256];
+    char name[256];
+    LPCSTR cmdline;
+#if 0
     LPCSTR p = NULL;
+#endif
 
     /* Get name and command line */
 
@@ -822,26 +825,21 @@ BOOL WINAPI CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine,
     }
 
     name[0] = '\0';
-    cmdline[0] = '\0';
 
     if (lpApplicationName) {
         get_executable_name( lpApplicationName, name, sizeof(name), NULL, FALSE);
-        strcpy(cmdline, name);
 #if 0
         p = strrchr(name, '.');
         if (p >= name+strlen(name)-4) /* FIXME */
             *p = '\0';
 #endif
     }
-    if (lpCommandLine) 
-        if (strlen(name)) {
-            get_executable_name(lpCommandLine, cmdline, sizeof(cmdline), &p, TRUE);
-            strcat(cmdline, p);
-                } else {
-            get_executable_name(lpCommandLine, name, sizeof(name), &p, TRUE);
-            strcpy(cmdline, name);
-            strcat(cmdline, p);
-        }
+    else {
+      get_executable_name ( lpCommandLine, name, sizeof ( name ), NULL, FALSE );
+    }
+    if (!lpCommandLine) 
+      cmdline = lpApplicationName;
+    else cmdline = lpCommandLine;
 
     if (!strchr(name, '\\') && !strchr(name, '.'))
         strcat(name, ".exe");
-- 
GitLab