Module: wine Branch: refs/heads/master Commit: c060cdbc149d5358931b5c69ae0b4146ed7ae5ae URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=c060cdbc149d5358931b5c69...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Jul 24 13:59:44 2006 +0200
ntdll: Propagate the MEM_TOP_DOWN flag into the map_view() function.
---
dlls/ntdll/virtual.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index 0782da2..20a94b9 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -585,7 +585,7 @@ static inline void *unmap_extra_space( v * The csVirtual section must be held by caller. */ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, size_t mask, - BYTE vprot ) + int top_down, BYTE vprot ) { void *ptr; NTSTATUS status; @@ -861,11 +861,11 @@ static NTSTATUS map_image( HANDLE hmappi RtlEnterCriticalSection( &csVirtual );
if (base >= (char *)0x110000) /* make sure the DOS area remains free */ - status = map_view( &view, base, total_size, mask, + status = map_view( &view, base, total_size, mask, FALSE, VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY | VPROT_IMAGE );
if (status == STATUS_CONFLICTING_ADDRESSES) - status = map_view( &view, NULL, total_size, mask, + status = map_view( &view, NULL, total_size, mask, FALSE, VPROT_COMMITTED | VPROT_READ | VPROT_EXEC | VPROT_WRITECOPY | VPROT_IMAGE );
if (status != STATUS_SUCCESS) goto error; @@ -1159,7 +1159,7 @@ NTSTATUS VIRTUAL_alloc_teb( void **ret, virtual_init();
*ret = NULL; - status = map_view( &view, NULL, size, size - 1, + status = map_view( &view, NULL, size, size - 1, TRUE, VPROT_READ | VPROT_WRITE | VPROT_COMMITTED ); if (status == STATUS_SUCCESS) { @@ -1276,17 +1276,12 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( size = (size + page_mask) & ~page_mask; }
- if (type & MEM_TOP_DOWN) { - /* FIXME: MEM_TOP_DOWN allocates the largest possible address. */ - WARN("MEM_TOP_DOWN ignored\n"); - type &= ~MEM_TOP_DOWN; - } - /* Compute the alloc type flags */
if (!(type & MEM_SYSTEM)) { - if (!(type & (MEM_COMMIT | MEM_RESERVE)) || (type & ~(MEM_COMMIT | MEM_RESERVE))) + if (!(type & (MEM_COMMIT | MEM_RESERVE)) || + (type & ~(MEM_COMMIT | MEM_RESERVE | MEM_TOP_DOWN))) { WARN("called with wrong alloc type flags (%08lx) !\n", type); return STATUS_INVALID_PARAMETER; @@ -1311,7 +1306,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( } else if ((type & MEM_RESERVE) || !base) { - status = map_view( &view, base, size, mask, vprot ); + status = map_view( &view, base, size, mask, type & MEM_TOP_DOWN, vprot ); if (status == STATUS_SUCCESS) { view->flags |= VFLAG_VALLOC; @@ -1819,7 +1814,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HAND
RtlEnterCriticalSection( &csVirtual );
- res = map_view( &view, *addr_ptr, size, mask, prot ); + res = map_view( &view, *addr_ptr, size, mask, FALSE, prot ); if (res) { RtlLeaveCriticalSection( &csVirtual );