about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/box64context.h3
-rw-r--r--src/main.c2
-rw-r--r--src/wrapped/wrappedlibc.c5
3 files changed, 10 insertions, 0 deletions
diff --git a/src/include/box64context.h b/src/include/box64context.h
index 52a512fa..c3493e7e 100644
--- a/src/include/box64context.h
+++ b/src/include/box64context.h
@@ -100,6 +100,9 @@ typedef struct box64context_s {
     int                 envc;
     char**              envv;
 
+    int                 orig_argc;
+    char**              orig_argv;
+
     char*               fullpath;
     char*               box64path;      // path of current box64 executable
     char*               box86path;      // path of box86 executable (if present)
diff --git a/src/main.c b/src/main.c
index 5f06fa24..cddfbc44 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2031,6 +2031,8 @@ int main(int argc, const char **argv, char **env) {
         memset(endp - diff, 0, diff); // fill reminder with NULL
         for(int i=nextarg; i<argc; ++i)
             argv[i] -= diff;    // adjust strings
+        my_context->orig_argc = argc;
+        my_context->orig_argv = (char**)argv;
     }
     box64_isglibc234 = GetNeededVersionForLib(elf_header, "libc.so.6", "GLIBC_2.34");
     if(box64_isglibc234)
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c
index 107eeb94..6629585f 100644
--- a/src/wrapped/wrappedlibc.c
+++ b/src/wrapped/wrappedlibc.c
@@ -3437,6 +3437,11 @@ EXPORT int my_prctl(x64emu_t* emu, int option, unsigned long arg2, unsigned long
     if(option==PR_SET_NAME) {
         printf_log(LOG_DEBUG, "BOX64: set process name to \"%s\"\n", (char*)arg2);
         ApplyParams((char*)arg2);
+        size_t l = strlen((char*)arg2);
+        if(l>4 && !strcasecmp((char*)arg2+l-4, ".exe")) {
+            printf_log(LOG_DEBUG, "BOX64: hacking orig command line to \"%s\"\n", (char*)arg2);
+            strcpy(my_context->orig_argv[0], (char*)arg2);
+        }
     }
     if(option==PR_SET_SECCOMP) {
         printf_log(LOG_INFO, "BOX64: ignoring prctl(PR_SET_SECCOMP, ...)\n");