summaryrefslogtreecommitdiff
path: root/emulators/wine/files
diff options
context:
space:
mode:
authorAlexander Vereeken <Alexander88207@protonmail.com>2023-12-17 22:58:41 +0000
committerGerald Pfeifer <gerald@FreeBSD.org>2023-12-17 22:59:27 +0000
commit0f2052c3784e3b8d5aed85aab22b8a49613ee85c (patch)
treebaef0d43dbe2b5d37287180c9ddc62a008db4e53 /emulators/wine/files
parentmail/thunderbird: update to 115.6.0 (diff)
emulators/wine: Unbreak WoW64
This is an excerpt of 1f07ec6014 by Alex S <iwtcex@gmail.com> for emulators/wine-proton. PR: 275677
Diffstat (limited to 'emulators/wine/files')
-rw-r--r--emulators/wine/files/patch-dlls_ntdll_unix_loader.c24
-rw-r--r--emulators/wine/files/wine.sh11
2 files changed, 33 insertions, 2 deletions
diff --git a/emulators/wine/files/patch-dlls_ntdll_unix_loader.c b/emulators/wine/files/patch-dlls_ntdll_unix_loader.c
new file mode 100644
index 000000000000..c290524821a4
--- /dev/null
+++ b/emulators/wine/files/patch-dlls_ntdll_unix_loader.c
@@ -0,0 +1,24 @@
+--- dlls/ntdll/unix/loader.c.orig 2023-07-19 15:29:22 UTC
++++ dlls/ntdll/unix/loader.c
+@@ -694,6 +694,21 @@ static NTSTATUS loader_exec( char **argv, WORD machine
+ {
+ if (machine != current_machine)
+ {
++ char* wineserver_path = getenv("WINESERVER");
++ if (wineserver_path != NULL && wineserver_path[0] == '/') {
++ char* s = remove_tail(wineserver_path, "server");
++ if (s != NULL) {
++ if (machine == IMAGE_FILE_MACHINE_AMD64) {
++ argv[1] = malloc(strlen(s) + 3);
++ strcpy(argv[1], s);
++ strcat(argv[1], "64");
++ } else {
++ argv[1] = s;
++ }
++ preloader_exec(argv);
++ }
++ }
++
+ if (machine == IMAGE_FILE_MACHINE_AMD64) /* try the 64-bit loader */
+ {
+ size_t len = strlen(wineloader);
diff --git a/emulators/wine/files/wine.sh b/emulators/wine/files/wine.sh
index 96a350fce615..057406196371 100644
--- a/emulators/wine/files/wine.sh
+++ b/emulators/wine/files/wine.sh
@@ -2,9 +2,16 @@
TARGET="$(realpath "$0")"
-if [ -z "$WINESERVER" ] && [ -f "${TARGET}server32" ]
+if [ -z "$WINESERVER" ]
then
- export WINESERVER="${TARGET}server32"
+ if [ -f "${TARGET%/*}/wineserver" ]
+ then
+ export WINESERVER="${TARGET%/*}/wineserver"
+ fi
+ if [ -f "${TARGET%/*}/wineserver32" ]
+ then
+ export WINESERVER="${TARGET%/*}/wineserver32"
+ fi
fi
# Workaround for https://bugs.winehq.org/show_bug.cgi?id=50257