mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 17:03:02 +00:00
[WINESYNC] dbghelp: Correctly determine the wine loader base address.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 185d9ee7ebf56e0663f715e532f2ee2c27289f12 by Zebediah Figura <zfigura@codeweavers.com>
This commit is contained in:
parent
f69be6c561
commit
ee8dbf8e10
3 changed files with 43 additions and 3 deletions
|
@ -572,6 +572,27 @@ struct cpu
|
||||||
|
|
||||||
extern struct cpu* dbghelp_current_cpu DECLSPEC_HIDDEN;
|
extern struct cpu* dbghelp_current_cpu DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
/* Abbreviated 32-bit PEB */
|
||||||
|
typedef struct _PEB32
|
||||||
|
{
|
||||||
|
BOOLEAN InheritedAddressSpace;
|
||||||
|
BOOLEAN ReadImageFileExecOptions;
|
||||||
|
BOOLEAN BeingDebugged;
|
||||||
|
BOOLEAN SpareBool;
|
||||||
|
DWORD Mutant;
|
||||||
|
DWORD ImageBaseAddress;
|
||||||
|
DWORD LdrData;
|
||||||
|
DWORD ProcessParameters;
|
||||||
|
DWORD SubSystemData;
|
||||||
|
DWORD ProcessHeap;
|
||||||
|
DWORD FastPebLock;
|
||||||
|
DWORD FastPebLockRoutine;
|
||||||
|
DWORD FastPebUnlockRoutine;
|
||||||
|
ULONG EnvironmentUpdateCount;
|
||||||
|
DWORD KernelCallbackTable;
|
||||||
|
ULONG Reserved[2];
|
||||||
|
} PEB32;
|
||||||
|
|
||||||
/* dbghelp.c */
|
/* dbghelp.c */
|
||||||
extern struct process* process_find_by_handle(HANDLE hProcess) DECLSPEC_HIDDEN;
|
extern struct process* process_find_by_handle(HANDLE hProcess) DECLSPEC_HIDDEN;
|
||||||
extern BOOL validate_addr64(DWORD64 addr) DECLSPEC_HIDDEN;
|
extern BOOL validate_addr64(DWORD64 addr) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -1574,8 +1574,27 @@ static BOOL elf_search_loader(struct process* pcs, struct elf_info* elf_info)
|
||||||
ULONG_PTR base = 0;
|
ULONG_PTR base = 0;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
if (!NtQueryInformationProcess( pcs->handle, ProcessBasicInformation, &pbi, sizeof(pbi), NULL ))
|
if (NtQueryInformationProcess( pcs->handle, ProcessBasicInformation,
|
||||||
ReadProcessMemory( pcs->handle, &pbi.PebBaseAddress->Reserved[0], &base, sizeof(base), NULL );
|
&pbi, sizeof(pbi), NULL ))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!pcs->is_64bit)
|
||||||
|
{
|
||||||
|
PEB32 *peb32 = (PEB32 *)pbi.PebBaseAddress;
|
||||||
|
DWORD base32;
|
||||||
|
|
||||||
|
if (!ReadProcessMemory( pcs->handle, &peb32->Reserved[0], &base32,
|
||||||
|
sizeof(base32), NULL ))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
base = base32;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!ReadProcessMemory( pcs->handle, &pbi.PebBaseAddress->Reserved[0],
|
||||||
|
&base, sizeof(base), NULL ))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
ret = elf_search_and_load_file(pcs, loader, base, 0, elf_info);
|
ret = elf_search_and_load_file(pcs, loader, base, 0, elf_info);
|
||||||
heap_free(loader);
|
heap_free(loader);
|
||||||
|
|
|
@ -3,4 +3,4 @@ directories:
|
||||||
files:
|
files:
|
||||||
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
||||||
tags:
|
tags:
|
||||||
wine: a981edf0bc7c828e6b55fdc73b51a2f457043c4a
|
wine: 185d9ee7ebf56e0663f715e532f2ee2c27289f12
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue