dbghelp: Use the main module load address from the PEB.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Alexandre Julliard 2017-04-25 16:40:08 +02:00
parent d3bbd03c8f
commit 74f05b8660
1 changed files with 10 additions and 1 deletions

View File

@ -44,6 +44,7 @@
#endif
#include "dbghelp_private.h"
#include "winternl.h"
#include "image_private.h"
@ -1200,6 +1201,8 @@ static BOOL elf_load_file_from_fmap(struct process* pcs, const WCHAR* filename,
char* ptr = (char*)fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
unsigned long len;
if (load_offset) ptr += load_offset - fmap->u.elf.elf_start;
do
{
if (!ReadProcessMemory(pcs->handle, ptr, &dyn, sizeof(dyn), &len) ||
@ -1565,7 +1568,13 @@ static BOOL elf_enum_modules_internal(const struct process* pcs,
*/
static BOOL elf_search_loader(struct process* pcs, struct elf_info* elf_info)
{
return elf_search_and_load_file(pcs, get_wine_loader_name(), 0, 0, elf_info);
PROCESS_BASIC_INFORMATION pbi;
ULONG_PTR base = 0;
if (!NtQueryInformationProcess( pcs->handle, ProcessBasicInformation, &pbi, sizeof(pbi), NULL ))
ReadProcessMemory( pcs->handle, &pbi.PebBaseAddress->Reserved[0], &base, sizeof(base), NULL );
return elf_search_and_load_file(pcs, get_wine_loader_name(), base, 0, elf_info);
}
/******************************************************************