Jacek Caban : dbghelp: Support PE debug link files.

Alexandre Julliard julliard at winehq.org
Tue Mar 17 17:21:11 CDT 2020


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Mar 17 17:21:58 2020 +0100

dbghelp: Support PE debug link files.

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

---

 dlls/dbghelp/image_private.h | 1 +
 dlls/dbghelp/module.c        | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/dbghelp/image_private.h b/dlls/dbghelp/image_private.h
index a219427d46..2e1d9299e5 100644
--- a/dlls/dbghelp/image_private.h
+++ b/dlls/dbghelp/image_private.h
@@ -136,6 +136,7 @@ struct image_section_map
 BOOL image_check_alternate(struct image_file_map* fmap, const struct module* module) DECLSPEC_HIDDEN;
 
 BOOL elf_map_handle(HANDLE handle, struct image_file_map* fmap) DECLSPEC_HIDDEN;
+BOOL pe_map_file(HANDLE file, struct image_file_map* fmap, enum module_type mt) DECLSPEC_HIDDEN;
 
 struct image_file_map_ops
 {
diff --git a/dlls/dbghelp/module.c b/dlls/dbghelp/module.c
index 32cb1caf32..9c8fb662f0 100644
--- a/dlls/dbghelp/module.c
+++ b/dlls/dbghelp/module.c
@@ -540,8 +540,10 @@ static BOOL refresh_module_list(struct process* pcs)
 
 static BOOL image_check_debug_link(const WCHAR* file, struct image_file_map* fmap, DWORD link_crc)
 {
+    DWORD read_bytes;
     HANDLE handle;
     WCHAR *path;
+    WORD magic;
     BOOL ret;
 
     path = get_dos_file_name(file);
@@ -560,7 +562,11 @@ static BOOL image_check_debug_link(const WCHAR* file, struct image_file_map* fma
         }
     }
 
-    ret = elf_map_handle(handle, fmap);
+    SetFilePointer(handle, 0, 0, FILE_BEGIN);
+    if (ReadFile(handle, &magic, sizeof(magic), &read_bytes, NULL) && magic == IMAGE_DOS_SIGNATURE)
+        ret = pe_map_file(handle, fmap, DMT_PE);
+    else
+        ret = elf_map_handle(handle, fmap);
     CloseHandle(handle);
     return ret;
 }




More information about the wine-cvs mailing list