dbghelp: Support PE debug link files.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-03-17 17:21:58 +01:00 committed by Alexandre Julliard
parent 0dd4958688
commit 2642f43eab
2 changed files with 8 additions and 1 deletions

View File

@ -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
{

View File

@ -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,6 +562,10 @@ static BOOL image_check_debug_link(const WCHAR* file, struct image_file_map* fma
}
}
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;