Module: wine Branch: master Commit: 7e16acf3806f9e810884d710c640f5f82c158093 URL: https://source.winehq.org/git/wine.git/?a=commit;h=7e16acf3806f9e810884d710c...
Author: Piotr Caban piotr@codeweavers.com Date: Tue Feb 18 17:02:06 2020 +0100
dbghelp: Use RtlImageDirectoryEntryToData in pe_load_msc_debug_info.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dbghelp/pe_module.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index b046b987bd..0f00b684ba 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -572,19 +572,15 @@ static BOOL pe_load_msc_debug_info(const struct process* pcs, struct module* mod { struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap; BOOL ret = FALSE; - const IMAGE_DATA_DIRECTORY* dir; - const IMAGE_DEBUG_DIRECTORY*dbg = NULL; - int nDbg; + const IMAGE_DEBUG_DIRECTORY*dbg; + ULONG nDbg; void* mapping; IMAGE_NT_HEADERS* nth;
if (!(mapping = pe_map_full(fmap, &nth))) return FALSE; /* Read in debug directory */ - dir = nth->OptionalHeader.DataDirectory + IMAGE_DIRECTORY_ENTRY_DEBUG; - nDbg = dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY); - if (!nDbg) goto done; - - dbg = RtlImageRvaToVa(nth, mapping, dir->VirtualAddress, NULL); + dbg = RtlImageDirectoryEntryToData( mapping, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &nDbg ); + if (!dbg || !(nDbg /= sizeof(IMAGE_DEBUG_DIRECTORY))) goto done;
/* Parse debug directory */ if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED)