winedump: Add support for long section names (at least used by MinGW).
This commit is contained in:
parent
02c06f0d66
commit
1c238c77f7
|
@ -88,7 +88,7 @@ static void dump_long_import(const void *base, const IMAGE_SECTION_HEADER *ish,
|
||||||
for (i = 0; i < num_sect; i++)
|
for (i = 0; i < num_sect; i++)
|
||||||
{
|
{
|
||||||
if (globals.do_dumpheader)
|
if (globals.do_dumpheader)
|
||||||
dump_section(&ish[i]);
|
dump_section(&ish[i], NULL);
|
||||||
|
|
||||||
if (globals.do_dump_rawdata)
|
if (globals.do_dump_rawdata)
|
||||||
{
|
{
|
||||||
|
|
|
@ -371,10 +371,14 @@ static void dump_pe_header(void)
|
||||||
dump_optional_header((const IMAGE_OPTIONAL_HEADER32*)&PE_nt_headers->OptionalHeader, PE_nt_headers->FileHeader.SizeOfOptionalHeader);
|
dump_optional_header((const IMAGE_OPTIONAL_HEADER32*)&PE_nt_headers->OptionalHeader, PE_nt_headers->FileHeader.SizeOfOptionalHeader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_section(const IMAGE_SECTION_HEADER *sectHead)
|
void dump_section(const IMAGE_SECTION_HEADER *sectHead, const char* strtable)
|
||||||
{
|
{
|
||||||
printf(" %-8.8s VirtSize: 0x%08x VirtAddr: 0x%08x\n",
|
if (strtable && sectHead->Name[0] == '/') /* long section name */
|
||||||
sectHead->Name, sectHead->Misc.VirtualSize, sectHead->VirtualAddress);
|
printf(" %.8s (%s)", sectHead->Name, strtable + atoi((const char*)sectHead->Name + 1));
|
||||||
|
else
|
||||||
|
printf(" %-8.8s", sectHead->Name);
|
||||||
|
printf(" VirtSize: 0x%08x VirtAddr: 0x%08x\n",
|
||||||
|
sectHead->Misc.VirtualSize, sectHead->VirtualAddress);
|
||||||
printf(" raw data offs: 0x%08x raw data size: 0x%08x\n",
|
printf(" raw data offs: 0x%08x raw data size: 0x%08x\n",
|
||||||
sectHead->PointerToRawData, sectHead->SizeOfRawData);
|
sectHead->PointerToRawData, sectHead->SizeOfRawData);
|
||||||
printf(" relocation offs: 0x%08x relocations: 0x%08x\n",
|
printf(" relocation offs: 0x%08x relocations: 0x%08x\n",
|
||||||
|
@ -448,11 +452,21 @@ static void dump_sections(const void *base, const void* addr, unsigned num_sect)
|
||||||
{
|
{
|
||||||
const IMAGE_SECTION_HEADER* sectHead = addr;
|
const IMAGE_SECTION_HEADER* sectHead = addr;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
const char* strtable;
|
||||||
|
|
||||||
|
if (PE_nt_headers->FileHeader.PointerToSymbolTable && PE_nt_headers->FileHeader.NumberOfSymbols)
|
||||||
|
{
|
||||||
|
/* FIXME: no way to get strtable size */
|
||||||
|
strtable = (const char*)base +
|
||||||
|
PE_nt_headers->FileHeader.PointerToSymbolTable +
|
||||||
|
PE_nt_headers->FileHeader.NumberOfSymbols * sizeof(IMAGE_SYMBOL);
|
||||||
|
}
|
||||||
|
else strtable = NULL;
|
||||||
|
|
||||||
printf("Section Table\n");
|
printf("Section Table\n");
|
||||||
for (i = 0; i < num_sect; i++, sectHead++)
|
for (i = 0; i < num_sect; i++, sectHead++)
|
||||||
{
|
{
|
||||||
dump_section(sectHead);
|
dump_section(sectHead, strtable);
|
||||||
|
|
||||||
if (globals.do_dump_rawdata)
|
if (globals.do_dump_rawdata)
|
||||||
{
|
{
|
||||||
|
|
|
@ -234,7 +234,7 @@ const char* get_guid_str(const GUID* guid);
|
||||||
const char* get_symbol_str(const char* symname);
|
const char* get_symbol_str(const char* symname);
|
||||||
void dump_file_header(const IMAGE_FILE_HEADER *);
|
void dump_file_header(const IMAGE_FILE_HEADER *);
|
||||||
void dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *, UINT);
|
void dump_optional_header(const IMAGE_OPTIONAL_HEADER32 *, UINT);
|
||||||
void dump_section(const IMAGE_SECTION_HEADER *);
|
void dump_section(const IMAGE_SECTION_HEADER *, const char* strtable);
|
||||||
|
|
||||||
enum FileSig get_kind_exec(void);
|
enum FileSig get_kind_exec(void);
|
||||||
void dos_dump( void );
|
void dos_dump( void );
|
||||||
|
|
Loading…
Reference in New Issue