From: Eric Pouech epouech@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58742
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/dbghelp/pe_module.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index 948708ac5a3..eb0954d156a 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -643,33 +643,35 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod
if (!(mapping = pe_map_full(fmap, &nth))) return FALSE; /* Read in debug directory */ - dbg = RtlImageDirectoryEntryToData( mapping, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &nDbg ); - nDbg = dbg ? nDbg / sizeof(IMAGE_DEBUG_DIRECTORY) : 0; - - /* Parse debug directory */ - if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED) + if ((dbg = RtlImageDirectoryEntryToData( mapping, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &nDbg ))) { - /* Debug info is stripped to .DBG file */ - const IMAGE_DEBUG_MISC* misc = (const IMAGE_DEBUG_MISC*) - ((const char*)mapping + dbg->PointerToRawData); + nDbg /= sizeof(IMAGE_DEBUG_DIRECTORY);
- if (nDbg != 1 || dbg->Type != IMAGE_DEBUG_TYPE_MISC || - misc->DataType != IMAGE_DEBUG_MISC_EXENAME) + /* Parse debug directory */ + if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED) { - WARN("-Debug info stripped, but no .DBG file in module %s\n", - debugstr_w(module->modulename)); + /* Debug info is stripped to .DBG file */ + const IMAGE_DEBUG_MISC* misc = (const IMAGE_DEBUG_MISC*) + ((const char*)mapping + dbg->PointerToRawData); + + if (nDbg != 1 || dbg->Type != IMAGE_DEBUG_TYPE_MISC || + misc->DataType != IMAGE_DEBUG_MISC_EXENAME) + { + WARN("-Debug info stripped, but no .DBG file in module %s\n", + debugstr_w(module->modulename)); + } + else + { + ret = pe_load_dbg_file(pcs, module, (const char*)misc->Data, nth->FileHeader.TimeDateStamp); + } } else { - ret = pe_load_dbg_file(pcs, module, (const char*)misc->Data, nth->FileHeader.TimeDateStamp); + /* Debug info is embedded into PE module */ + ret = pe_load_debug_directory(pcs, module, mapping, IMAGE_FIRST_SECTION( nth ), + nth->FileHeader.NumberOfSections, dbg, nDbg); } } - else - { - /* Debug info is embedded into PE module */ - ret = pe_load_debug_directory(pcs, module, mapping, IMAGE_FIRST_SECTION( nth ), - nth->FileHeader.NumberOfSections, dbg, nDbg); - } pe_unmap_full(fmap); return ret; }