[WINESYNC] 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>

wine commit id 7e16acf3806f9e810884d710c640f5f82c158093 by Piotr Caban <piotr@codeweavers.com>
This commit is contained in:
winesync 2020-09-11 16:53:38 +02:00 committed by Jérôme Gardou
parent e27e4dbaee
commit a6145efdfd
2 changed files with 9 additions and 22 deletions

View file

@ -465,7 +465,7 @@ static BOOL pe_load_coff_symbol_table(struct module* module)
/****************************************************************** /******************************************************************
* pe_load_stabs * pe_load_stabs
* *
* look for stabs information in PE header (it's how the mingw compiler provides * look for stabs information in PE header (it's how the mingw compiler provides
* its debugging information) * its debugging information)
*/ */
static BOOL pe_load_stabs(const struct process* pcs, struct module* module) static BOOL pe_load_stabs(const struct process* pcs, struct module* module)
@ -601,28 +601,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; struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap;
BOOL ret = FALSE; BOOL ret = FALSE;
const IMAGE_DATA_DIRECTORY* dir; const IMAGE_DEBUG_DIRECTORY*dbg;
const IMAGE_DEBUG_DIRECTORY*dbg = NULL; ULONG nDbg;
int nDbg;
void* mapping; void* mapping;
IMAGE_NT_HEADERS* nth; IMAGE_NT_HEADERS* nth;
if (!(mapping = pe_map_full(fmap, &nth))) return FALSE; if (!(mapping = pe_map_full(fmap, &nth))) return FALSE;
/* Read in debug directory */ /* Read in debug directory */
dir = nth->OptionalHeader.DataDirectory + IMAGE_DIRECTORY_ENTRY_DEBUG; dbg = RtlImageDirectoryEntryToData( mapping, FALSE, IMAGE_DIRECTORY_ENTRY_DEBUG, &nDbg );
nDbg = dir->Size / sizeof(IMAGE_DEBUG_DIRECTORY); if (!dbg || !(nDbg /= sizeof(IMAGE_DEBUG_DIRECTORY))) goto done;
if (!nDbg) goto done;
dbg = RtlImageRvaToVa(nth, mapping, dir->VirtualAddress, NULL);
#ifdef __REACTOS__
if (!dbg)
{
ERR("Debug directory not found in module %s\n",
debugstr_w(module->module.ModuleName));
goto done;
}
#endif
/* Parse debug directory */ /* Parse debug directory */
if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED) if (nth->FileHeader.Characteristics & IMAGE_FILE_DEBUG_STRIPPED)
@ -676,18 +663,18 @@ static BOOL pe_load_export_debug_info(const struct process* pcs, struct module*
/* FIXME: module.ModuleName isn't correctly set yet if it's passed in SymLoadModule */ /* FIXME: module.ModuleName isn't correctly set yet if it's passed in SymLoadModule */
symt_new_public(module, NULL, module->module.ModuleName, FALSE, base, 1); symt_new_public(module, NULL, module->module.ModuleName, FALSE, base, 1);
#endif #endif
/* Add entry point */ /* Add entry point */
symt_new_public(module, NULL, "EntryPoint", FALSE, symt_new_public(module, NULL, "EntryPoint", FALSE,
base + nth->OptionalHeader.AddressOfEntryPoint, 1); base + nth->OptionalHeader.AddressOfEntryPoint, 1);
#if 0 #if 0
/* FIXME: we'd better store addresses linked to sections rather than /* FIXME: we'd better store addresses linked to sections rather than
absolute values */ absolute values */
IMAGE_SECTION_HEADER* section; IMAGE_SECTION_HEADER* section;
/* Add start of sections */ /* Add start of sections */
section = (IMAGE_SECTION_HEADER*) section = (IMAGE_SECTION_HEADER*)
((char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader); ((char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++) for (i = 0; i < nth->FileHeader.NumberOfSections; i++, section++)
{ {
symt_new_public(module, NULL, section->Name, FALSE, symt_new_public(module, NULL, section->Name, FALSE,
RtlImageRvaToVa(nth, mapping, section->VirtualAddress, NULL), 1); RtlImageRvaToVa(nth, mapping, section->VirtualAddress, NULL), 1);

View file

@ -4,4 +4,4 @@ files:
include/dbghelp.h: sdk/include/psdk/dbghelp.h include/dbghelp.h: sdk/include/psdk/dbghelp.h
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
tags: tags:
wine: ab4c64a4093b98ca7a74ec29a9d947333791b26d wine: 7e16acf3806f9e810884d710c640f5f82c158093