mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 12:23:25 +00:00
[WINESYNC] dbghelp: Correctly determine the wine loader base address.
Signed-off-by: Zebediah Figura <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id 185d9ee7ebf56e0663f715e532f2ee2c27289f12 by Zebediah Figura <[email protected]>
This commit is contained in:
@@ -572,6 +572,27 @@ struct cpu
|
||||
|
||||
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 */
|
||||
extern struct process* process_find_by_handle(HANDLE hProcess) 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;
|
||||
BOOL ret;
|
||||
|
||||
if (!NtQueryInformationProcess( pcs->handle, ProcessBasicInformation, &pbi, sizeof(pbi), NULL ))
|
||||
ReadProcessMemory( pcs->handle, &pbi.PebBaseAddress->Reserved[0], &base, sizeof(base), NULL );
|
||||
if (NtQueryInformationProcess( pcs->handle, ProcessBasicInformation,
|
||||
&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);
|
||||
heap_free(loader);
|
||||
|
||||
@@ -3,4 +3,4 @@ directories:
|
||||
files:
|
||||
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
||||
tags:
|
||||
wine: a981edf0bc7c828e6b55fdc73b51a2f457043c4a
|
||||
wine: 185d9ee7ebf56e0663f715e532f2ee2c27289f12
|
||||
|
||||
Reference in New Issue
Block a user