Fixed wrong file offset used when mapping the import directory from a

shared section.
This commit is contained in:
Alexandre Julliard 2003-05-08 03:50:32 +00:00
parent 8534f79124
commit c808e67da1
1 changed files with 3 additions and 2 deletions

View File

@ -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 ); UINT_PTR end = base + ROUND_SIZE( imports->VirtualAddress, imports->Size );
if (end > sec->VirtualAddress + size) end = sec->VirtualAddress + size; if (end > sec->VirtualAddress + size) end = sec->VirtualAddress + size;
if (end > base) VIRTUAL_mmap( shared_fd, ptr + base, end - base, 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 ); MAP_PRIVATE|MAP_FIXED, NULL );
} }
pos += size; pos += size;
@ -1245,7 +1246,7 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
info->BaseAddress = (LPVOID)base; info->BaseAddress = (LPVOID)base;
info->AllocationBase = (LPVOID)alloc_base; info->AllocationBase = (LPVOID)alloc_base;
info->RegionSize = size - (base - alloc_base); info->RegionSize = size - (base - alloc_base);
*res_len = sizeof(*info); if (res_len) *res_len = sizeof(*info);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }