diff options
Diffstat (limited to 'src/reader')
-rw-r--r-- | src/reader/pe_read_dos_header.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/reader/pe_read_dos_header.c b/src/reader/pe_read_dos_header.c index 53faf55..0fd0367 100644 --- a/src/reader/pe_read_dos_header.c +++ b/src/reader/pe_read_dos_header.c @@ -4,10 +4,10 @@ /* Released under GPLv2 and GPLv3; see COPYING.PERK. */ /***************************************************************/ -#include <endian.h> #include <string.h> #include <perk/perk.h> +#include "perk_endian_impl.h" #include "perk_reader_impl.h" int pe_read_dos_header(const struct pe_image_dos_hdr * p, struct pe_meta_image_dos_hdr * m) @@ -15,44 +15,44 @@ int pe_read_dos_header(const struct pe_image_dos_hdr * p, struct pe_meta_image_d if ((p->dos_magic[0] != 'M') || (p->dos_magic[1] != 'Z')) return PERK_BAD_DOS_HEADER; - #if (BYTE_ORDER == LITTLE_ENDIAN) + if (PERK_LITTLE_ENDIAN) { - memcpy(m,p,sizeof(*p)); + memcpy(m,p,sizeof(*p)); - #else + } else { - int i; + int i; - m->dos_magic[0] = p->dos_magic[0]; - m->dos_magic[1] = p->dos_magic[1]; + m->dos_magic[0] = p->dos_magic[0]; + m->dos_magic[1] = p->dos_magic[1]; - m->dos_cblp = pe_read_short(p->dos_cblp); - m->dos_cp = pe_read_short(p->dos_cp); - m->dos_crlc = pe_read_short(p->dos_crlc); - m->dos_cparhdr = pe_read_short(p->dos_cparhdr); - m->dos_minalloc = pe_read_short(p->dos_minalloc); - m->dos_maxalloc = pe_read_short(p->dos_maxalloc); - m->dos_ss = pe_read_short(p->dos_ss); - m->dos_sp = pe_read_short(p->dos_sp); - m->dos_csum = pe_read_short(p->dos_csum); - m->dos_ip = pe_read_short(p->dos_ip); - m->dos_cs = pe_read_short(p->dos_cs); - m->dos_lfarlc = pe_read_short(p->dos_lfarlc); - m->dos_ovno = pe_read_short(p->dos_ovno); + m->dos_cblp = pe_read_short(p->dos_cblp); + m->dos_cp = pe_read_short(p->dos_cp); + m->dos_crlc = pe_read_short(p->dos_crlc); + m->dos_cparhdr = pe_read_short(p->dos_cparhdr); + m->dos_minalloc = pe_read_short(p->dos_minalloc); + m->dos_maxalloc = pe_read_short(p->dos_maxalloc); + m->dos_ss = pe_read_short(p->dos_ss); + m->dos_sp = pe_read_short(p->dos_sp); + m->dos_csum = pe_read_short(p->dos_csum); + m->dos_ip = pe_read_short(p->dos_ip); + m->dos_cs = pe_read_short(p->dos_cs); + m->dos_lfarlc = pe_read_short(p->dos_lfarlc); + m->dos_ovno = pe_read_short(p->dos_ovno); - for (i=0; i<4; i++) - m->dos_res[i] = pe_read_short(&p->dos_res[2*i]); + for (i=0; i<4; i++) + m->dos_res[i] = pe_read_short(&p->dos_res[2*i]); - m->dos_oemid = pe_read_short(p->dos_oemid); - m->dos_oeminfo = pe_read_short(p->dos_oeminfo); + m->dos_oemid = pe_read_short(p->dos_oemid); + m->dos_oeminfo = pe_read_short(p->dos_oeminfo); - for (i=0; i<10; i++) - m->dos_res2[i] = pe_read_short(&p->dos_res2[2*i]); + for (i=0; i<10; i++) + m->dos_res2[i] = pe_read_short(&p->dos_res2[2*i]); - m->dos_lfanew = pe_read_long(p->dos_lfanew); + m->dos_lfanew = pe_read_long(p->dos_lfanew); - #endif + } return 0; } |