Skip to content

Commit

Permalink
Added some hack to rename wine binary process too (help mesa pick up …
Browse files Browse the repository at this point in the history
…the correct binary being run)
  • Loading branch information
ptitSeb committed Feb 24, 2024
1 parent 14b978a commit 966bb72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/include/box86context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; i<argc; ++i)
argv[i] -= diff; // adjust strings
my_context->orig_argc = argc;
my_context->orig_argv = (char**)argv;
}
box86_isglibc234 = GetNeededVersionForLib(elf_header, "libc.so.6", "GLIBC_2.34");
if(box86_isglibc234)
Expand Down
5 changes: 5 additions & 0 deletions src/wrapped/wrappedlibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 966bb72

Please sign in to comment.