diff --git a/src/include/box86context.h b/src/include/box86context.h index dacee80e7..353724cc8 100755 --- a/src/include/box86context.h +++ b/src/include/box86context.h @@ -99,6 +99,9 @@ typedef struct box86context_s { int envc; char** envv; + int orig_argc; + char** orig_argv; + char* fullpath; char* box86path; // path of current box86 executable char* box64path; // path of box64 executable (beside box86, if it exists) diff --git a/src/main.c b/src/main.c index 752a8d90f..de7313754 100644 --- a/src/main.c +++ b/src/main.c @@ -1705,6 +1705,8 @@ int main(int argc, const char **argv, char **env) memset(endp - diff, 0, diff); // fill reminder with NULL for(int i=nextarg; iorig_argc = argc; + my_context->orig_argv = (char**)argv; } box86_isglibc234 = GetNeededVersionForLib(elf_header, "libc.so.6", "GLIBC_2.34"); if(box86_isglibc234) diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index f84c5ba12..54a84b144 100755 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -3329,6 +3329,11 @@ EXPORT int my_prctl(x86emu_t* emu, int option, unsigned long arg2, unsigned long if(option==PR_SET_NAME) { printf_log(LOG_DEBUG, "BOX86: set process name to \"%s\"\n", (char*)arg2); ApplyParams((char*)arg2, NULL); + size_t l = strlen((char*)arg2); + if(l>4 && !strcasecmp((char*)arg2+l-4, ".exe")) { + printf_log(LOG_DEBUG, "BOX86: hacking orig command line to \"%s\"\n", (char*)arg2); + strcpy(my_context->orig_argv[0], (char*)arg2); + } } return prctl(option, arg2, arg3, arg4, arg5); }