winedump: Simplify code a bit by using IMAGE_FIRST_SECTION() macro.
This commit is contained in:
parent
b722e77299
commit
0957cd03dd
|
@ -570,12 +570,11 @@ void dump_coff_symbol_table(const IMAGE_SYMBOL *coff_symbols, unsigned num_sy
|
|||
}
|
||||
}
|
||||
|
||||
void dump_coff(unsigned long coffbase, unsigned long len, const void* pmt)
|
||||
void dump_coff(unsigned long coffbase, unsigned long len, const IMAGE_SECTION_HEADER* sectHead)
|
||||
{
|
||||
const IMAGE_COFF_SYMBOLS_HEADER *coff = PRD(coffbase, len);
|
||||
const IMAGE_SYMBOL *coff_symbols =
|
||||
(const IMAGE_SYMBOL *) ((const char *)coff + coff->LvaToFirstSymbol);
|
||||
const IMAGE_SECTION_HEADER *sectHead = pmt;
|
||||
|
||||
dump_coff_symbol_table(coff_symbols, coff->NumberOfSymbols, sectHead);
|
||||
}
|
||||
|
|
|
@ -883,7 +883,7 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx)
|
|||
break;
|
||||
case IMAGE_DEBUG_TYPE_COFF:
|
||||
dump_coff(idd->PointerToRawData, idd->SizeOfData,
|
||||
(const char*)PE_nt_headers + sizeof(DWORD) + sizeof(IMAGE_FILE_HEADER) + PE_nt_headers->FileHeader.SizeOfOptionalHeader);
|
||||
IMAGE_FIRST_SECTION(PE_nt_headers));
|
||||
break;
|
||||
case IMAGE_DEBUG_TYPE_CODEVIEW:
|
||||
dump_codeview(idd->PointerToRawData, idd->SizeOfData);
|
||||
|
@ -1383,9 +1383,7 @@ static void dump_debug(void)
|
|||
unsigned i;
|
||||
const IMAGE_SECTION_HEADER* sectHead;
|
||||
|
||||
sectHead = (const IMAGE_SECTION_HEADER*)
|
||||
((const char*)PE_nt_headers + sizeof(DWORD) +
|
||||
sizeof(IMAGE_FILE_HEADER) + PE_nt_headers->FileHeader.SizeOfOptionalHeader);
|
||||
sectHead = IMAGE_FIRST_SECTION(PE_nt_headers);
|
||||
|
||||
for (i = 0; i < PE_nt_headers->FileHeader.NumberOfSections; i++, sectHead++)
|
||||
{
|
||||
|
@ -1456,8 +1454,7 @@ void pe_dump(void)
|
|||
{
|
||||
dump_pe_header();
|
||||
/* FIXME: should check ptr */
|
||||
dump_sections(PRD(0, 1), (const char*)PE_nt_headers + sizeof(DWORD) +
|
||||
sizeof(IMAGE_FILE_HEADER) + PE_nt_headers->FileHeader.SizeOfOptionalHeader,
|
||||
dump_sections(PRD(0, 1), IMAGE_FIRST_SECTION(PE_nt_headers),
|
||||
PE_nt_headers->FileHeader.NumberOfSections);
|
||||
}
|
||||
else if (!globals.dumpsect)
|
||||
|
|
|
@ -260,7 +260,8 @@ void codeview_dump_linetab2(const char* linetab, DWORD size, const ch
|
|||
|
||||
void dump_stabs(const void* pv_stabs, unsigned szstabs, const char* stabstr, unsigned szstr);
|
||||
void dump_codeview(unsigned long ptr, unsigned long len);
|
||||
void dump_coff(unsigned long coffbase, unsigned long len, const void* sect_map);
|
||||
void dump_coff(unsigned long coffbase, unsigned long len,
|
||||
const IMAGE_SECTION_HEADER *sectHead);
|
||||
void dump_coff_symbol_table(const IMAGE_SYMBOL *coff_symbols, unsigned num_sym,
|
||||
const IMAGE_SECTION_HEADER *sectHead);
|
||||
void dump_frame_pointer_omission(unsigned long base, unsigned long len);
|
||||
|
|
Loading…
Reference in New Issue