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.
This commit is contained in:
Robert Shearman 2004-10-04 19:30:50 +00:00 committed by Alexandre Julliard
parent 0d2cb29952
commit be7c95a3e5
2 changed files with 16 additions and 10 deletions

View file

@ -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;

View file

@ -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));