Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ void usage(){
" -dc Dumps the Certificate\n"
" -ds Dumps the Sections\n"
" -dl Dumps the Library Sections\n\n"
" -gdb Dumps sections adresses, for use with gdb\n\n"

" -vh Verifies the .xbe Header \n"
" -wb Writes back the update to file out.xbe \n\n"
Expand Down Expand Up @@ -82,11 +83,12 @@ int main (int argc, const char * argv[])

for (counter=2;counter<argc;counter++){

if (strcmp(argv[counter],"-da")==0) dumpflag |= 0x000000ff;
if (strcmp(argv[counter],"-dh")==0) dumpflag |= 0x00000001;
if (strcmp(argv[counter],"-dc")==0) dumpflag |= 0x00000002;
if (strcmp(argv[counter],"-ds")==0) dumpflag |= 0x00000004;
if (strcmp(argv[counter],"-dl")==0) dumpflag |= 0x00000008;
if (strcmp(argv[counter],"-da")==0) dumpflag |= 0x000000ff;
if (strcmp(argv[counter],"-dh")==0) dumpflag |= 0x00000001;
if (strcmp(argv[counter],"-dc")==0) dumpflag |= 0x00000002;
if (strcmp(argv[counter],"-ds")==0) dumpflag |= 0x00000004;
if (strcmp(argv[counter],"-dl")==0) dumpflag |= 0x00000008;
if (strcmp(argv[counter],"-gdb")==0) dumpflag |= 0x00000100;

if (strcmp(argv[counter],"-sm")==0) dumpflag |= 0x00000000;
if (strcmp(argv[counter],"-st")==0) dumpflag |= 0x10000000;
Expand Down
13 changes: 13 additions & 0 deletions xbedump.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,19 @@ if (option_flag & 0x00000002) {

sechdr = (XBE_SECTION *)(((char *)xbe) + (int)header->Sections - (int)header->BaseAddress);
for (i = 0; i < header->NumSections; i++, sechdr++) {
if (option_flag & 0x00000100) {
char *name = ((char *)xbe)+(int)sechdr->SectionName-(int)header->BaseAddress;
if (!strcmp(name,".text")) {
printf("0x%08X ", sechdr->VirtualAddress);
}else if (!strcmp(name,".bss") || !strcmp(name,".data") || !strcmp(name,".rdata")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: space before else

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there ever be any reason why someone wouldn't want to map the rest of the sections?

printf("-s %s 0x%08X ", name, sechdr->VirtualAddress);
}
if (i == header->NumSections-1) {
printf("\n");
}
}


if (option_flag & 0x00000004) {
printf("\nSection Header %i\n~~~~~~~~~~~~~~~~~\n", i);

Expand Down