Module: wine Branch: master Commit: 8ec843e77b3b921a9b9be1397af6ba77b3ba797d URL: https://source.winehq.org/git/wine.git/?a=commit;h=8ec843e77b3b921a9b9be1397...
Author: Rémi Bernon rbernon@codeweavers.com Date: Fri Dec 4 17:34:08 2020 +0100
dbghelp: Read process memory using target addresses, not debugger.
This fixes "wine winedbg --gdb winecfg" not working anymore.
There was a regression since f40195cd9206, but the environment read was broken before.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dbghelp/dbghelp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c index e38687412eb..00d7b61fbd8 100644 --- a/dlls/dbghelp/dbghelp.c +++ b/dlls/dbghelp/dbghelp.c @@ -311,8 +311,8 @@ static BOOL check_live_target(struct process* pcs) { PEB peb; if (!ReadProcessMemory(pcs->handle, pbi.PebBaseAddress, &peb, sizeof(peb), NULL)) return FALSE; - if (!ReadProcessMemory(pcs->handle, &peb.CloudFileFlags, &base, sizeof(base), NULL)) return FALSE; - ReadProcessMemory(pcs->handle, &peb.ProcessParameters->Environment, &env, sizeof(env), NULL); + if (!ReadProcessMemory(pcs->handle, (char *)pbi.PebBaseAddress + FIELD_OFFSET(PEB, CloudFileFlags), &base, sizeof(base), NULL)) return FALSE; + ReadProcessMemory(pcs->handle, (char *)peb.ProcessParameters + FIELD_OFFSET(RTL_USER_PROCESS_PARAMETERS, Environment), &env, sizeof(env), NULL); }
/* read debuggee environment block */