hdmap / wine-hackery

Dumping ground for random wine patches
23 stars 1 forks source link

f4se/mapimagetopdown.patch does not apply #1

Open petteyg opened 4 years ago

petteyg commented 4 years ago

This patch does not apply on wine-staging anymore. As of 2019-11-25, another patch was added to wine-staging 0001-ntdll-Force-bottom-up-allocation-order-for-64-bit-ar.patch, but I'm not sure how to make the "top_down" true for xxSE games.

qsniyg commented 4 years ago

Those patches have already been upstreamed, but wine-staging currently breaks it for different reasons (see https://bugs.winehq.org/show_bug.cgi?id=48641). Try running patchinstall.sh with -W ntdll-ForceBottomUpAlloc.

qsniyg commented 3 years ago

The issue now occurs on wine vanilla as well.

The following hack works for me (basically a rebased version of mapimagetopdown.patch):

diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 8374dd97326..89b72486789 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -2288,7 +2288,7 @@ static NTSTATUS open_dll_file( UNICODE_STRING *nt_name, WINE_MODREF **pwm, void
         }
         NtQuerySection( mapping, SectionImageInformation, image_info, sizeof(*image_info), NULL );
         status = NtMapViewOfSection( mapping, NtCurrentProcess(), module, 0, 0, NULL, &len,
-                                     ViewShare, 0, PAGE_EXECUTE_READ );
+                                     ViewShare, MEM_TOP_DOWN, PAGE_EXECUTE_READ );
         if (status == STATUS_IMAGE_NOT_AT_BASE) status = STATUS_SUCCESS;
         NtClose( mapping );
     }
diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c
index c2b6ea603e3..34915d5c6e7 100644
--- a/dlls/ntdll/unix/loader.c
+++ b/dlls/ntdll/unix/loader.c
@@ -1187,7 +1187,7 @@ static NTSTATUS open_dll_file( const char *name, void **module, SECTION_IMAGE_IN
     }
     NtQuerySection( mapping, SectionImageInformation, image_info, sizeof(*image_info), NULL );
     status = NtMapViewOfSection( mapping, NtCurrentProcess(), module, 0, 0, NULL, &len,
-                                 ViewShare, 0, PAGE_EXECUTE_READ );
+                                 ViewShare, MEM_TOP_DOWN, PAGE_EXECUTE_READ );
     if (status == STATUS_IMAGE_NOT_AT_BASE) status = STATUS_SUCCESS;
     NtClose( mapping );
     if (status) return status;