From: Paul Gofman pgofman@codeweavers.com
--- dlls/ntdll/unix/virtual.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 2aadb1def00..2f74e6e0896 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -1980,6 +1980,36 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, void *ptr; NTSTATUS status;
+ if (alloc_type & MEM_REPLACE_PLACEHOLDER) + { + if (!(*view_ret = find_view( base, 0 ))) + { + TRACE( "MEM_REPLACE_PLACEHOLDER view not found.\n" ); + return STATUS_INVALID_PARAMETER; + } + TRACE( "found view %p, size %p, protect %#x.\n", + (*view_ret)->base, (void *)(*view_ret)->size, (*view_ret)->protect ); + + if ((*view_ret)->base != base || (*view_ret)->size != size) + { + WARN( "Wrond range.\n" ); + return STATUS_CONFLICTING_ADDRESSES; + } + + if (!((*view_ret)->protect & VPROT_FREE_PLACEHOLDER)) + { + TRACE( "Wrong protect %#x for MEM_REPLACE_PLACEHOLDER.\n", (*view_ret)->protect ); + return STATUS_INVALID_PARAMETER; + } + (*view_ret)->protect = vprot | VPROT_PLACEHOLDER; + + if (!set_vprot( *view_ret, base, size, vprot )) + ERR( "set_protection failed.\n" ); + if (vprot & VPROT_WRITEWATCH) + reset_write_watches( base, size ); + return STATUS_SUCCESS; + } + if (base) { if (is_beyond_limit( base, size, address_space_limit ))