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