Module: wine Branch: master Commit: 25db1c5d49dc339e9b5a25514c198a524bd05484 URL: https://gitlab.winehq.org/wine/wine/-/commit/25db1c5d49dc339e9b5a25514c198a5...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Oct 3 15:23:31 2023 +0200
ntdll: Always allocate dynamically relocatable dlls top-down.
---
dlls/ntdll/unix/virtual.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 25487d7c3cd..26bb52bc792 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -2857,6 +2857,8 @@ static NTSTATUS map_image_view( struct file_view **view_ret, pe_image_info_t *im void *base = wine_server_get_ptr( image_info->base ); NTSTATUS status; ULONG_PTR start, end; + BOOL top_down = (image_info->image_charact & IMAGE_FILE_DLL) && + (image_info->image_flags & IMAGE_FLAGS_ImageDynamicallyRelocated);
limit_low = max( limit_low, (ULONG_PTR)address_space_start ); /* make sure the DOS area remains free */ if (!limit_high) limit_high = (ULONG_PTR)user_space_limit; @@ -2865,6 +2867,7 @@ static NTSTATUS map_image_view( struct file_view **view_ret, pe_image_info_t *im
if (base && (ULONG_PTR)base == image_info->base) { + if (top_down) alloc_type |= MEM_TOP_DOWN; status = map_view( view_ret, base, size, alloc_type, vprot, limit_low, limit_high, 0 ); if (!status) return status; } @@ -2883,13 +2886,13 @@ static NTSTATUS map_image_view( struct file_view **view_ret, pe_image_info_t *im } if (start < end && (start != limit_low || end != limit_high)) { - status = map_view( view_ret, NULL, size, alloc_type, vprot, start, end, 0 ); + status = map_view( view_ret, NULL, size, top_down ? MEM_TOP_DOWN : 0, vprot, start, end, 0 ); if (!status) return status; }
/* then any suitable address */
- return map_view( view_ret, NULL, size, alloc_type, vprot, limit_low, limit_high, 0 ); + return map_view( view_ret, NULL, size, top_down ? MEM_TOP_DOWN : 0, vprot, limit_low, limit_high, 0 ); }