Jacek Caban : dbghelp: Pass process struct to image_uses_split_segs.

Alexandre Julliard julliard at winehq.org
Tue Mar 24 15:28:16 CDT 2020


Module: wine
Branch: master
Commit: 2a5160c4f2eb80dcc8770cd10d702a5d8233314f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2a5160c4f2eb80dcc8770cd10d702a5d8233314f

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Mar 24 01:54:46 2020 +0100

dbghelp: Pass process struct to image_uses_split_segs.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dbghelp/macho_module.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/dlls/dbghelp/macho_module.c b/dlls/dbghelp/macho_module.c
index 4847a434fd..73d0575a4b 100644
--- a/dlls/dbghelp/macho_module.c
+++ b/dlls/dbghelp/macho_module.c
@@ -1255,18 +1255,17 @@ found:
  * The image header has to be loaded from the process's memory
  * because the relevant flag is only set in memory, not in the file.
  */
-static BOOL image_uses_split_segs(HANDLE process, unsigned long load_addr)
+static BOOL image_uses_split_segs(struct process* process, unsigned long load_addr)
 {
     BOOL split_segs = FALSE;
 
-    if (process && load_addr)
+    if (load_addr)
     {
-        struct process *pcs = process_find_by_handle(process);
-        cpu_type_t target_cpu = (pcs->is_64bit) ? CPU_TYPE_X86_64 : CPU_TYPE_X86;
-        uint32_t target_magic = (pcs->is_64bit) ? MH_MAGIC_64 : MH_MAGIC;
+        cpu_type_t target_cpu = (process->is_64bit) ? CPU_TYPE_X86_64 : CPU_TYPE_X86;
+        uint32_t target_magic = (process->is_64bit) ? MH_MAGIC_64 : MH_MAGIC;
         struct mach_header header;
 
-        if (ReadProcessMemory(process, (void*)load_addr, &header, sizeof(header), NULL) &&
+        if (ReadProcessMemory(process->handle, (void*)load_addr, &header, sizeof(header), NULL) &&
             header.magic == target_magic && header.cputype == target_cpu &&
             header.flags & MACHO_DYLD_IN_SHARED_CACHE)
         {
@@ -1351,7 +1350,7 @@ static BOOL macho_fetch_file_info(struct process* process, const WCHAR* name, UL
 
     TRACE("(%s, %p, %p, %p)\n", debugstr_w(name), base, size, checksum);
 
-    split_segs = image_uses_split_segs(process->handle, load_addr);
+    split_segs = image_uses_split_segs(process, load_addr);
     if (!macho_map_file(process, name, split_segs, &fmap)) return FALSE;
     if (base) *base = fmap.u.macho.segs_start;
     *size = fmap.u.macho.segs_size;
@@ -1449,7 +1448,7 @@ static BOOL macho_load_file(struct process* pcs, const WCHAR* filename,
     TRACE("(%p/%p, %s, 0x%08lx, %p/0x%08x)\n", pcs, pcs->handle, debugstr_w(filename),
             load_addr, macho_info, macho_info->flags);
 
-    split_segs = image_uses_split_segs(pcs->handle, load_addr);
+    split_segs = image_uses_split_segs(pcs, load_addr);
     if (!macho_map_file(pcs, filename, split_segs, &fmap)) return FALSE;
 
     /* Find the dynamic loader's table of images loaded into the process.




More information about the wine-cvs mailing list