Commit 2d338e22 authored by Alexandre Julliard's avatar Alexandre Julliard

winedump: Display PE section offsets using their virtual address.

parent 2328a1d9
......@@ -33,11 +33,11 @@
void *dump_base = NULL;
size_t dump_total_len = 0;
void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix )
void dump_data_offset( const unsigned char *ptr, unsigned int size, unsigned int offset, const char *prefix )
{
unsigned int i, j;
printf( "%s%08x: ", prefix, 0 );
printf( "%s%08x: ", prefix, offset );
if (!ptr)
{
printf("NULL\n");
......@@ -51,7 +51,7 @@ void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix
printf( " " );
for (j = 0; j < 16; j++)
printf( "%c", isprint(ptr[i-15+j]) ? ptr[i-15+j] : '.' );
if (i < size-1) printf( "\n%s%08x: ", prefix, i + 1 );
if (i < size-1) printf( "\n%s%08x: ", prefix, offset + i + 1 );
}
}
if (i % 16)
......@@ -63,6 +63,11 @@ void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix
printf( "\n" );
}
void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix )
{
dump_data_offset( ptr, size, 0, prefix );
}
static char* dump_want_n(unsigned sz)
{
static char buffer[64 * 1024];
......
......@@ -539,7 +539,8 @@ static void dump_sections(const void *base, const void* addr, unsigned num_sect)
if (globals.do_dump_rawdata)
{
dump_data((const unsigned char *)base + sectHead->PointerToRawData, sectHead->SizeOfRawData, " " );
dump_data_offset((const unsigned char *)base + sectHead->PointerToRawData,
sectHead->SizeOfRawData, sectHead->VirtualAddress, " " );
printf("\n");
}
}
......
......@@ -224,6 +224,7 @@ unsigned long Offset(const void* ptr);
typedef void (*file_dumper)(void);
BOOL dump_analysis(const char*, file_dumper, enum FileSig);
void dump_data_offset( const unsigned char *ptr, unsigned int size, unsigned int offset, const char *prefix );
void dump_data( const unsigned char *ptr, unsigned int size, const char *prefix );
const char* get_time_str( unsigned long );
unsigned int strlenW( const unsigned short *str );
......
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