diff --git a/dlls/dbghelp/image_private.h b/dlls/dbghelp/image_private.h index a219427d46b..2e1d9299e5f 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 32cb1caf32a..9c8fb662f09 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; }