From 6e32dff2ad6ef357b860d947641995ceaea20dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Moln=C3=A1r?= Date: Wed, 17 Jan 2007 21:53:18 +0100 Subject: [PATCH] armpe_tester.c updated to work with files containing 4 sections --- src/stub/tools/armpe/armpe_tester.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/stub/tools/armpe/armpe_tester.c b/src/stub/tools/armpe/armpe_tester.c index 5e083c99..a47c1f1a 100644 --- a/src/stub/tools/armpe/armpe_tester.c +++ b/src/stub/tools/armpe/armpe_tester.c @@ -150,7 +150,7 @@ enum { #define get_le16(p) (*(unsigned short *) (p)) static struct pe_header_t ih; -static struct pe_section_t isections[3]; +static struct pe_section_t isections[4]; static FILE *f; static void *vaddr; static FILE *out; @@ -203,7 +203,8 @@ static int load(const char *file) if (ih.cpu != 0x1c0 && ih.cpu != 0x1c2) return print("unsupported processor type: %x\n", ih.cpu); - if (ih.objects != 3 || fread(isections, sizeof(isections), 1, f) != 1) + if ((ih.objects != 3 && ih.objects != 4) + || fread(isections, sizeof(isections), 1, f) != 1) return print("error reading section descriptors\n"); return 0; @@ -225,7 +226,7 @@ static int read(void) print("VirtualAlloc() ok %x\n", vaddr); #endif - for (ic = 1; ic <= 2; ic++) + for (ic = 1; ic <= (unsigned) ih.objects - 1; ic++) if (fseek(f, isections[ic].rawdataptr, SEEK_SET) || fread(vaddr + isections[ic].vaddr, isections[ic].vsize, 1, f) != 1)