Module: wine Branch: master Commit: 78ffde79fe5fe8bbd782bd03590e2ebeff6759c3 URL: https://gitlab.winehq.org/wine/wine/-/commit/78ffde79fe5fe8bbd782bd03590e2eb...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Jun 8 13:21:10 2023 +0200
ntdll: Report the remaining part of the 64K after a view as free.
To avoid returning non-aligned reserved regions.
---
dlls/ntdll/unix/virtual.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 5dd03c6cc85..167203301f1 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -4638,6 +4638,18 @@ static unsigned int fill_basic_memory_info( const void *addr, MEMORY_BASIC_INFOR if (area_end < alloc_end) info->RegionSize = area_end - base; break; } + /* report the remaining part of the 64K after the view as free */ + if ((UINT_PTR)alloc_base & granularity_mask) + { + char *next = (char *)ROUND_ADDR( alloc_base, granularity_mask ) + granularity_mask + 1; + + if (base < next) + { + info->RegionSize = min( next, alloc_end ) - base; + break; + } + else alloc_base = base; + } /* pretend it's allocated */ if (area_start < alloc_end) info->RegionSize = area_start - base; info->State = MEM_RESERVE;