Commit be7c95a3 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

Fix the loading .dbg files by no longer using RtlImageNtHeader which

would return NULL and using looking at the IMAGE_SEPARATE_DEBUG_HEADER directly instead.
parent 0d2cb299
......@@ -2997,11 +2997,12 @@ BOOL pe_load_debug_directory(const struct process* pcs, struct module* module,
BOOL ret;
int i;
struct msc_debug_info msc_dbg;
const IMAGE_NT_HEADERS* nth = RtlImageNtHeader((void*)mapping);
const IMAGE_SEPARATE_DEBUG_HEADER* dbg_hdr = (const IMAGE_SEPARATE_DEBUG_HEADER*)mapping;
msc_dbg.module = module;
msc_dbg.nsect = nth->FileHeader.NumberOfSections;
msc_dbg.sectp = (const IMAGE_SECTION_HEADER*)((const char*)&nth->OptionalHeader + nth->FileHeader.SizeOfOptionalHeader);
msc_dbg.nsect = dbg_hdr->NumberOfSections;
/* section headers come immediately after debug header */
msc_dbg.sectp = (const IMAGE_SECTION_HEADER*)(dbg_hdr + 1);
msc_dbg.nomap = 0;
msc_dbg.omapp = NULL;
......
......@@ -115,13 +115,18 @@ static BOOL pe_load_dbg_file(const struct process* pcs, struct module* module,
* which have incorrect timestamps.
*/
}
dbg = (const IMAGE_DEBUG_DIRECTORY*)
(dbg_mapping + sizeof(*hdr) +
hdr->NumberOfSections * sizeof(IMAGE_SECTION_HEADER) +
hdr->ExportedNamesSize);
ret = pe_load_debug_directory(pcs, module, dbg_mapping, dbg,
hdr->DebugDirectorySize / sizeof(*dbg));
if (hdr->Signature == IMAGE_SEPARATE_DEBUG_SIGNATURE)
{
dbg = (const IMAGE_DEBUG_DIRECTORY*)
(dbg_mapping + sizeof(*hdr) +
hdr->NumberOfSections * sizeof(IMAGE_SECTION_HEADER) +
hdr->ExportedNamesSize);
ret = pe_load_debug_directory(pcs, module, dbg_mapping, dbg,
hdr->DebugDirectorySize / sizeof(*dbg));
}
else
ERR("Wrong signature in .DBG file %s\n", debugstr_a(tmp));
}
else
WINE_ERR("-Unable to peruse .DBG file %s (%s)\n", dbg_name, debugstr_a(tmp));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment