Commit 83c272a2 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Return STATUS_IMAGE_NOT_AT_BASE when an image mapping has to be relocated.

parent 74a059d2
...@@ -545,7 +545,7 @@ LPVOID WINAPI MapViewOfFileEx( HANDLE handle, DWORD access, ...@@ -545,7 +545,7 @@ LPVOID WINAPI MapViewOfFileEx( HANDLE handle, DWORD access,
if (access & FILE_MAP_EXECUTE) protect <<= 4; if (access & FILE_MAP_EXECUTE) protect <<= 4;
if ((status = NtMapViewOfSection( handle, GetCurrentProcess(), &addr, 0, 0, &offset, if ((status = NtMapViewOfSection( handle, GetCurrentProcess(), &addr, 0, 0, &offset,
&count, ViewShare, 0, protect ))) &count, ViewShare, 0, protect )) < 0)
{ {
SetLastError( RtlNtStatusToDosError(status) ); SetLastError( RtlNtStatusToDosError(status) );
addr = NULL; addr = NULL;
......
...@@ -1498,7 +1498,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file, ...@@ -1498,7 +1498,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
status = NtMapViewOfSection( mapping, NtCurrentProcess(), status = NtMapViewOfSection( mapping, NtCurrentProcess(),
&module, 0, 0, &size, &len, ViewShare, 0, PAGE_READONLY ); &module, 0, 0, &size, &len, ViewShare, 0, PAGE_READONLY );
NtClose( mapping ); NtClose( mapping );
if (status != STATUS_SUCCESS) return status; if (status < 0) return status;
/* create the MODREF */ /* create the MODREF */
......
...@@ -1296,6 +1296,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz ...@@ -1296,6 +1296,7 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
#ifdef VALGRIND_LOAD_PDB_DEBUGINFO #ifdef VALGRIND_LOAD_PDB_DEBUGINFO
VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta); VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta);
#endif #endif
if (ptr != base) return STATUS_IMAGE_NOT_AT_BASE;
return STATUS_SUCCESS; return STATUS_SUCCESS;
error: error:
...@@ -2409,7 +2410,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p ...@@ -2409,7 +2410,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
res = NTDLL_queue_process_apc( process, &call, &result ); res = NTDLL_queue_process_apc( process, &call, &result );
if (res != STATUS_SUCCESS) return res; if (res != STATUS_SUCCESS) return res;
if (result.map_view.status == STATUS_SUCCESS) if ((NTSTATUS)result.map_view.status >= 0)
{ {
*addr_ptr = wine_server_get_ptr( result.map_view.addr ); *addr_ptr = wine_server_get_ptr( result.map_view.addr );
*size_ptr = result.map_view.size; *size_ptr = result.map_view.size;
...@@ -2461,7 +2462,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p ...@@ -2461,7 +2462,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
-1, dup_mapping, addr_ptr ); -1, dup_mapping, addr_ptr );
} }
if (needs_close) close( unix_handle ); if (needs_close) close( unix_handle );
if (!res) *size_ptr = size; if (res >= 0) *size_ptr = size;
return res; return res;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment