https://git.reactos.org/?p=reactos.git;a=commitdiff;h=148591a8a6e59c95f7047f0b910a3fc2ee709fe0

commit 148591a8a6e59c95f7047f0b910a3fc2ee709fe0
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 13:16:16 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:34 2020 +0200

    [WINESYNC] dbghelp: Fix loading of Mach-O load commands for 64-bit binaries.
    
    Signed-off-by: Ken Thomases <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 3ff8fa7ed1d28b38703125b0c8c632410e3fd980 by Ken Thomases 
<[email protected]>
---
 dll/win32/dbghelp/image_private.h | 1 +
 dll/win32/dbghelp/macho_module.c  | 5 +++--
 sdk/tools/winesync/dbghelp.cfg    | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dll/win32/dbghelp/image_private.h 
b/dll/win32/dbghelp/image_private.h
index 6b435559d72..46275481f96 100644
--- a/dll/win32/dbghelp/image_private.h
+++ b/dll/win32/dbghelp/image_private.h
@@ -91,6 +91,7 @@ struct image_file_map
 
 #ifdef HAVE_MACH_O_LOADER_H
             struct mach_header          mach_header;
+            size_t                      header_size; /* size of real header in 
file */
             const struct load_command*  load_commands;
             const struct uuid_command*  uuid;
 
diff --git a/dll/win32/dbghelp/macho_module.c b/dll/win32/dbghelp/macho_module.c
index 9401dfb0c78..05130b7de8d 100644
--- a/dll/win32/dbghelp/macho_module.c
+++ b/dll/win32/dbghelp/macho_module.c
@@ -415,7 +415,7 @@ static const struct load_command* 
macho_map_load_commands(struct macho_file_map*
     if (fmap->load_commands == IMAGE_NO_MAP)
     {
         fmap->load_commands = (const struct load_command*) macho_map_range(
-                fmap, sizeof(fmap->mach_header), fmap->mach_header.sizeofcmds, 
NULL);
+                fmap, fmap->header_size, fmap->mach_header.sizeofcmds, NULL);
         TRACE("Mapped load commands: %p\n", fmap->load_commands);
     }
 
@@ -433,7 +433,7 @@ static void macho_unmap_load_commands(struct 
macho_file_map* fmap)
     {
         TRACE("Unmapping load commands: %p\n", fmap->load_commands);
         macho_unmap_range(NULL, (const void**)&fmap->load_commands, fmap,
-                    sizeof(fmap->mach_header), fmap->mach_header.sizeofcmds);
+                    fmap->header_size, fmap->mach_header.sizeofcmds);
     }
 }
 
@@ -666,6 +666,7 @@ static BOOL macho_map_file(struct process *pcs, const WCHAR 
*filenameW,
 
     ifm->modtype = DMT_MACHO;
     ifm->addr_size = (pcs->is_64bit) ? 64 : 32;
+    fmap->header_size = (pcs->is_64bit) ? sizeof(struct mach_header_64) : 
sizeof(struct mach_header);
 
     len = WideCharToMultiByte(CP_UNIXCP, 0, filenameW, -1, NULL, 0, NULL, 
NULL);
     if (!(filename = HeapAlloc(GetProcessHeap(), 0, len)))
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index a0a73e68571..9ca733f7598 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -3,4 +3,4 @@ directories:
 files:
   include/dbghelp.h: sdk/include/psdk/dbghelp.h
 tags:
-  wine: 053a7e225c8190fd7416b3f3c3186f1ac230eeb3
+  wine: 3ff8fa7ed1d28b38703125b0c8c632410e3fd980

Reply via email to