https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4a24f9acfc8d442f889e858bd03905b852439e49

commit 4a24f9acfc8d442f889e858bd03905b852439e49
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 13:05:43 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:32 2020 +0200

    [WINESYNC] dbghelp: Read the Elf_auxv_t struct corresponding to the 
target's architecture.
    
    Signed-off-by: Zebediah Figura <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 51ada19ac235df104e95476e9b3fa8204357bb9a by Zebediah Figura 
<[email protected]>
---
 dll/win32/dbghelp/elf_module.c    | 30 ++++++++++++++++++++++++------
 dll/win32/dbghelp/image_private.h |  2 --
 sdk/tools/winesync/dbghelp.cfg    |  2 +-
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c
index 2b444f8b015..0cbeb98c407 100644
--- a/dll/win32/dbghelp/elf_module.c
+++ b/dll/win32/dbghelp/elf_module.c
@@ -1522,7 +1522,6 @@ static BOOL elf_search_auxv(const struct process* pcs, 
unsigned type, unsigned l
     void*       addr;
     void*       str;
     void*       str_max;
-    Elf_auxv_t  auxv;
 
     si->SizeOfStruct = sizeof(*si);
     si->MaxNameLen = MAX_SYM_NAME;
@@ -1548,14 +1547,33 @@ static BOOL elf_search_auxv(const struct process* pcs, 
unsigned type, unsigned l
     while (addr < str_max && ReadProcessMemory(pcs->handle, addr, &str, 
sizeof(str), NULL) && str == NULL)
         addr = (void*)((DWORD_PTR)addr + sizeof(str));
 
-    while (ReadProcessMemory(pcs->handle, addr, &auxv, sizeof(auxv), NULL) && 
auxv.a_type != AT_NULL)
+    if (pcs->is_64bit)
     {
-        if (auxv.a_type == type)
+        Elf64_auxv_t auxv;
+
+        while (ReadProcessMemory(pcs->handle, addr, &auxv, sizeof(auxv), NULL) 
&& auxv.a_type != AT_NULL)
         {
-            *val = auxv.a_un.a_val;
-            return TRUE;
+            if (auxv.a_type == type)
+            {
+                *val = auxv.a_un.a_val;
+                return TRUE;
+            }
+            addr = (void*)((DWORD_PTR)addr + sizeof(auxv));
+        }
+    }
+    else
+    {
+        Elf32_auxv_t auxv;
+
+        while (ReadProcessMemory(pcs->handle, addr, &auxv, sizeof(auxv), NULL) 
&& auxv.a_type != AT_NULL)
+        {
+            if (auxv.a_type == type)
+            {
+                *val = auxv.a_un.a_val;
+                return TRUE;
+            }
+            addr = (void*)((DWORD_PTR)addr + sizeof(auxv));
         }
-        addr = (void*)((DWORD_PTR)addr + sizeof(auxv));
     }
 
     return FALSE;
diff --git a/dll/win32/dbghelp/image_private.h 
b/dll/win32/dbghelp/image_private.h
index 22e81ae3e01..ecd15a27c29 100644
--- a/dll/win32/dbghelp/image_private.h
+++ b/dll/win32/dbghelp/image_private.h
@@ -62,10 +62,8 @@ typedef struct section              macho_section;
 
 #ifdef _WIN64
 #define         Elf_Sym         Elf64_Sym
-#define         Elf_auxv_t      Elf64_auxv_t
 #else
 #define         Elf_Sym         Elf32_Sym
-#define         Elf_auxv_t      Elf32_auxv_t
 #endif
 #else
 #ifndef SHT_NULL
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index 15733bdd51b..eb2b78f98ff 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: bb53152faab705d972de3763ddd9bb3351e92460
+  wine: 51ada19ac235df104e95476e9b3fa8204357bb9a

Reply via email to