From c808e67da1a8d6e12e08552b2a1624eeb5afa1db Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 8 May 2003 03:50:32 +0000 Subject: [PATCH] Fixed wrong file offset used when mapping the import directory from a shared section. --- dlls/ntdll/virtual.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index d25d52f483e..99dc20b9960 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -645,7 +645,8 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, DWORD total_size UINT_PTR end = base + ROUND_SIZE( imports->VirtualAddress, imports->Size ); if (end > sec->VirtualAddress + size) end = sec->VirtualAddress + size; if (end > base) VIRTUAL_mmap( shared_fd, ptr + base, end - base, - pos, 0, PROT_READ|PROT_WRITE|PROT_EXEC, + pos + (base - sec->VirtualAddress), 0, + PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, NULL ); } pos += size; @@ -1245,7 +1246,7 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr, info->BaseAddress = (LPVOID)base; info->AllocationBase = (LPVOID)alloc_base; info->RegionSize = size - (base - alloc_base); - *res_len = sizeof(*info); + if (res_len) *res_len = sizeof(*info); return STATUS_SUCCESS; }