Alexandre Julliard : dbghelp: Use the main module load address from the PEB.

Alexandre Julliard julliard at winehq.org
Tue Apr 25 16:22:35 CDT 2017


Module: wine
Branch: master
Commit: 74f05b8660627c46536013ab433400e4e6d630eb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=74f05b8660627c46536013ab433400e4e6d630eb

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr 25 16:40:08 2017 +0200

dbghelp: Use the main module load address from the PEB.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dbghelp/elf_module.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index 6428955..e841b1b 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -44,6 +44,7 @@
 #endif
 
 #include "dbghelp_private.h"
+#include "winternl.h"
 
 #include "image_private.h"
 
@@ -1200,6 +1201,8 @@ static BOOL elf_load_file_from_fmap(struct process* pcs, const WCHAR* filename,
             char*           ptr = (char*)fmap->u.elf.sect[ism.sidx].shdr.sh_addr;
             unsigned long   len;
 
+            if (load_offset) ptr += load_offset - fmap->u.elf.elf_start;
+
             do
             {
                 if (!ReadProcessMemory(pcs->handle, ptr, &dyn, sizeof(dyn), &len) ||
@@ -1565,7 +1568,13 @@ static BOOL elf_enum_modules_internal(const struct process* pcs,
  */
 static BOOL elf_search_loader(struct process* pcs, struct elf_info* elf_info)
 {
-    return elf_search_and_load_file(pcs, get_wine_loader_name(), 0, 0, elf_info);
+    PROCESS_BASIC_INFORMATION pbi;
+    ULONG_PTR base = 0;
+
+    if (!NtQueryInformationProcess( pcs->handle, ProcessBasicInformation, &pbi, sizeof(pbi), NULL ))
+        ReadProcessMemory( pcs->handle, &pbi.PebBaseAddress->Reserved[0], &base, sizeof(base), NULL );
+
+    return elf_search_and_load_file(pcs, get_wine_loader_name(), base, 0, elf_info);
 }
 
 /******************************************************************




More information about the wine-cvs mailing list