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_COFF_SYMBOLS_HEADER *coff = PRD(coffbase, len);
|
||||||
const IMAGE_SYMBOL *coff_symbols =
|
const IMAGE_SYMBOL *coff_symbols =
|
||||||
(const IMAGE_SYMBOL *) ((const char *)coff + coff->LvaToFirstSymbol);
|
(const IMAGE_SYMBOL *) ((const char *)coff + coff->LvaToFirstSymbol);
|
||||||
const IMAGE_SECTION_HEADER *sectHead = pmt;
|
|
||||||
|
|
||||||
dump_coff_symbol_table(coff_symbols, coff->NumberOfSymbols, sectHead);
|
dump_coff_symbol_table(coff_symbols, coff->NumberOfSymbols, sectHead);
|
||||||
}
|
}
|
||||||
|
|
|
@ -882,8 +882,8 @@ static void dump_dir_debug_dir(const IMAGE_DEBUG_DIRECTORY* idd, int idx)
|
||||||
case IMAGE_DEBUG_TYPE_UNKNOWN:
|
case IMAGE_DEBUG_TYPE_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
case IMAGE_DEBUG_TYPE_COFF:
|
case IMAGE_DEBUG_TYPE_COFF:
|
||||||
dump_coff(idd->PointerToRawData, idd->SizeOfData,
|
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;
|
break;
|
||||||
case IMAGE_DEBUG_TYPE_CODEVIEW:
|
case IMAGE_DEBUG_TYPE_CODEVIEW:
|
||||||
dump_codeview(idd->PointerToRawData, idd->SizeOfData);
|
dump_codeview(idd->PointerToRawData, idd->SizeOfData);
|
||||||
|
@ -1383,9 +1383,7 @@ static void dump_debug(void)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
const IMAGE_SECTION_HEADER* sectHead;
|
const IMAGE_SECTION_HEADER* sectHead;
|
||||||
|
|
||||||
sectHead = (const IMAGE_SECTION_HEADER*)
|
sectHead = IMAGE_FIRST_SECTION(PE_nt_headers);
|
||||||
((const char*)PE_nt_headers + sizeof(DWORD) +
|
|
||||||
sizeof(IMAGE_FILE_HEADER) + PE_nt_headers->FileHeader.SizeOfOptionalHeader);
|
|
||||||
|
|
||||||
for (i = 0; i < PE_nt_headers->FileHeader.NumberOfSections; i++, sectHead++)
|
for (i = 0; i < PE_nt_headers->FileHeader.NumberOfSections; i++, sectHead++)
|
||||||
{
|
{
|
||||||
|
@ -1456,8 +1454,7 @@ void pe_dump(void)
|
||||||
{
|
{
|
||||||
dump_pe_header();
|
dump_pe_header();
|
||||||
/* FIXME: should check ptr */
|
/* FIXME: should check ptr */
|
||||||
dump_sections(PRD(0, 1), (const char*)PE_nt_headers + sizeof(DWORD) +
|
dump_sections(PRD(0, 1), IMAGE_FIRST_SECTION(PE_nt_headers),
|
||||||
sizeof(IMAGE_FILE_HEADER) + PE_nt_headers->FileHeader.SizeOfOptionalHeader,
|
|
||||||
PE_nt_headers->FileHeader.NumberOfSections);
|
PE_nt_headers->FileHeader.NumberOfSections);
|
||||||
}
|
}
|
||||||
else if (!globals.dumpsect)
|
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_stabs(const void* pv_stabs, unsigned szstabs, const char* stabstr, unsigned szstr);
|
||||||
void dump_codeview(unsigned long ptr, unsigned long len);
|
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,
|
void dump_coff_symbol_table(const IMAGE_SYMBOL *coff_symbols, unsigned num_sym,
|
||||||
const IMAGE_SECTION_HEADER *sectHead);
|
const IMAGE_SECTION_HEADER *sectHead);
|
||||||
void dump_frame_pointer_omission(unsigned long base, unsigned long len);
|
void dump_frame_pointer_omission(unsigned long base, unsigned long len);
|
||||||
|
|
Loading…
Reference in New Issue