Skip to content

Commit

Permalink
emulators/wine: Unbreak WoW64
Browse files Browse the repository at this point in the history
This is an excerpt of 1f07ec6 by Alex S <iwtcex@gmail.com> for
emulators/wine-proton.

PR:		275677
  • Loading branch information
Alexander88207 authored and Gerald Pfeifer committed Dec 17, 2023
1 parent a25f028 commit 0f2052c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
1 change: 1 addition & 0 deletions emulators/wine/Makefile
@@ -1,5 +1,6 @@
PORTNAME= wine
DISTVERSION= 8.0.2
PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= emulators
MASTER_SITES= https://dl.winehq.org/wine/source/8.0/
Expand Down
24 changes: 24 additions & 0 deletions 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);
11 changes: 9 additions & 2 deletions emulators/wine/files/wine.sh
Expand Up @@ -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
Expand Down

0 comments on commit 0f2052c

Please sign in to comment.