https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a6145efdfd9e2645320d0…
commit a6145efdfd9e2645320d0c7a87f92711684a1b00
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Fri Sep 11 16:53:38 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Sep 16 10:35:43 2020 +0200
[WINESYNC] dbghelp: Use RtlImageDirectoryEntryToData in pe_load_msc_debug_info.
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 7e16acf3806f9e810884d710c640f5f82c158093 by Piotr Caban
<piotr(a)codeweavers.com>
---
dll/win32/dbghelp/pe_module.c | 29 ++++++++---------------------
sdk/tools/winesync/dbghelp.cfg | 2 +-
2 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/dll/win32/dbghelp/pe_module.c b/dll/win32/dbghelp/pe_module.c
index 7fcaf27e6c7..54a830c5420 100644
--- a/dll/win32/dbghelp/pe_module.c
+++ b/dll/win32/dbghelp/pe_module.c
@@ -465,7 +465,7 @@ static BOOL pe_load_coff_symbol_table(struct module* module)
/******************************************************************
* 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)
*/
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;
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);
-
-#ifdef __REACTOS__
- if (!dbg)
- {
- ERR("Debug directory not found in module %s\n",
- debugstr_w(module->module.ModuleName));
- goto done;
- }
-#endif
+ 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)
@@ -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 */
symt_new_public(module, NULL, module->module.ModuleName, FALSE, base, 1);
#endif
-
+
/* Add entry point */
symt_new_public(module, NULL, "EntryPoint", FALSE,
base + nth->OptionalHeader.AddressOfEntryPoint, 1);
#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 */
IMAGE_SECTION_HEADER* section;
/* Add start of sections */
section = (IMAGE_SECTION_HEADER*)
((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,
RtlImageRvaToVa(nth, mapping, section->VirtualAddress, NULL),
1);
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index dcca9791c8c..80fc0c075da 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -4,4 +4,4 @@ files:
include/dbghelp.h: sdk/include/psdk/dbghelp.h
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
tags:
- wine: ab4c64a4093b98ca7a74ec29a9d947333791b26d
+ wine: 7e16acf3806f9e810884d710c640f5f82c158093