https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8f9ab8954d92e3c88f94941e1ef9beb1670e0e42

commit 8f9ab8954d92e3c88f94941e1ef9beb1670e0e42
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 18:54:57 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:52 2020 +0200

    [WINESYNC] dbghelp: Use local declarations of r_debug and link_map structs.
    
    Signed-off-by: Jacek Caban <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 11ea231501f4f2a54433031ada21052d81641fee by Jacek Caban 
<[email protected]>
---
 dll/win32/dbghelp/elf_module.c | 94 +++++++++++++++++-------------------------
 sdk/tools/winesync/dbghelp.cfg |  2 +-
 2 files changed, 39 insertions(+), 57 deletions(-)

diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c
index 6bdbcdeb3e7..cca07ead31e 100644
--- a/dll/win32/dbghelp/elf_module.c
+++ b/dll/win32/dbghelp/elf_module.c
@@ -47,49 +47,6 @@
 #define ELF_INFO_MODULE         0x0002
 #define ELF_INFO_NAME           0x0004
 
-#ifndef HAVE_STRUCT_R_DEBUG
-struct r_debug
-{
-    int r_version;
-    struct link_map *r_map;
-    ElfW(Addr) r_brk;
-    enum
-    {
-        RT_CONSISTENT,
-        RT_ADD,
-        RT_DELETE
-    } r_state;
-    ElfW(Addr) r_ldbase;
-};
-#endif /* HAVE_STRUCT_R_DEBUG */
-
-struct r_debug32
-{
-    int r_version;
-    DWORD r_map;
-    Elf32_Addr r_brk;
-    int r_state;
-    Elf32_Addr r_ldbase;
-};
-
-#ifndef HAVE_STRUCT_LINK_MAP
-struct link_map
-{
-    ElfW(Addr) l_addr;
-    char *l_name;
-    ElfW(Dyn) *l_ld;
-    struct link_map *l_next, *l_prev;
-};
-#endif /* HAVE_STRUCT_LINK_MAP */
-
-struct link_map32
-{
-    Elf32_Addr l_addr;
-    DWORD l_name;
-    DWORD l_ld;
-    DWORD l_next, l_prev;
-};
-
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
 struct elf_info
@@ -1402,12 +1359,25 @@ static BOOL elf_enum_modules_internal(const struct 
process* pcs,
 {
     WCHAR bufstrW[MAX_PATH];
     char bufstr[256];
-    void *lm_addr;
+    ULONG_PTR lm_addr;
 
     if (pcs->is_64bit)
     {
-        struct r_debug dbg_hdr;
-        struct link_map lm;
+        struct
+        {
+            UINT32 r_version;
+            UINT64 r_map;
+            UINT64 r_brk;
+            UINT32 r_state;
+            UINT64 r_ldbase;
+        } dbg_hdr;
+        struct
+        {
+            UINT64 l_addr;
+            UINT64 l_name;
+            UINT64 l_ld;
+            UINT64 l_next, l_prev;
+        } lm;
 
         if (!pcs->dbg_hdr_addr ||
             !ReadProcessMemory(pcs->handle, (void*)pcs->dbg_hdr_addr,
@@ -1419,14 +1389,14 @@ static BOOL elf_enum_modules_internal(const struct 
process* pcs,
          * cases the first entry doesn't appear with a name, in other cases it
          * does.
          */
-        for (lm_addr = (void*)dbg_hdr.r_map; lm_addr; lm_addr = 
(void*)lm.l_next)
+        for (lm_addr = dbg_hdr.r_map; lm_addr; lm_addr = lm.l_next)
         {
-            if (!ReadProcessMemory(pcs->handle, lm_addr, &lm, sizeof(lm), 
NULL))
+            if (!ReadProcessMemory(pcs->handle, (void*)lm_addr, &lm, 
sizeof(lm), NULL))
                 return FALSE;
 
-            if (lm.l_prev != NULL && /* skip first entry, normally debuggee 
itself */
-                lm.l_name != NULL &&
-                ReadProcessMemory(pcs->handle, lm.l_name, bufstr, 
sizeof(bufstr), NULL))
+            if (lm.l_prev && /* skip first entry, normally debuggee itself */
+                lm.l_name &&
+                ReadProcessMemory(pcs->handle, (void*)(ULONG_PTR)lm.l_name, 
bufstr, sizeof(bufstr), NULL))
             {
                 bufstr[sizeof(bufstr) - 1] = '\0';
                 MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW, 
ARRAY_SIZE(bufstrW));
@@ -1438,8 +1408,21 @@ static BOOL elf_enum_modules_internal(const struct 
process* pcs,
     }
     else
     {
-        struct r_debug32 dbg_hdr;
-        struct link_map32 lm;
+        struct
+        {
+            UINT32 r_version;
+            UINT32 r_map;
+            UINT32 r_brk;
+            UINT32 r_state;
+            UINT32 r_ldbase;
+        } dbg_hdr;
+        struct
+        {
+            UINT32 l_addr;
+            UINT32 l_name;
+            UINT32 l_ld;
+            UINT32 l_next, l_prev;
+        } lm;
 
         if (!pcs->dbg_hdr_addr ||
             !ReadProcessMemory(pcs->handle, (void*)pcs->dbg_hdr_addr,
@@ -1451,10 +1434,9 @@ static BOOL elf_enum_modules_internal(const struct 
process* pcs,
          * cases the first entry doesn't appear with a name, in other cases it
          * does.
          */
-        for (lm_addr = (void *)(DWORD_PTR)dbg_hdr.r_map; lm_addr;
-             lm_addr = (void *)(DWORD_PTR)lm.l_next)
+        for (lm_addr = dbg_hdr.r_map; lm_addr; lm_addr = lm.l_next)
         {
-            if (!ReadProcessMemory(pcs->handle, lm_addr, &lm, sizeof(lm), 
NULL))
+            if (!ReadProcessMemory(pcs->handle, (void*)lm_addr, &lm, 
sizeof(lm), NULL))
                 return FALSE;
 
             if (lm.l_prev && /* skip first entry, normally debuggee itself */
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index 03cb11af8a4..2c4fb3b3dfd 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -4,4 +4,4 @@ files:
   include/dbghelp.h: sdk/include/psdk/dbghelp.h
   include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
 tags:
-  wine: 620019fd71fd519470b4d624949a74fba9f350e9
+  wine: 11ea231501f4f2a54433031ada21052d81641fee

Reply via email to