diff options
author | midipix <writeonce@midipix.org> | 2016-05-06 09:38:20 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-10 23:35:44 -0500 |
commit | cc6bfcbad73f113ed1c82771fdacf66ab0d5ffc9 (patch) | |
tree | 4ae1ef8e5a420545262ab477c2fd194f537aa952 /src/reader | |
parent | ee94ee05b08fd12be9f175b26e353c9063d0fc07 (diff) | |
download | perk-cc6bfcbad73f113ed1c82771fdacf66ab0d5ffc9.tar.bz2 perk-cc6bfcbad73f113ed1c82771fdacf66ab0d5ffc9.tar.xz |
pe_read_export_header(): integrate runtime little endian test.
Diffstat (limited to 'src/reader')
-rw-r--r-- | src/reader/pe_read_export_header.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/reader/pe_read_export_header.c b/src/reader/pe_read_export_header.c index 544c3a4..545b81e 100644 --- a/src/reader/pe_read_export_header.c +++ b/src/reader/pe_read_export_header.c @@ -4,35 +4,35 @@ /* 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_export_header(const struct pe_export_hdr * p, struct pe_meta_export_hdr * m) { - #if (BYTE_ORDER == LITTLE_ENDIAN) + if (PERK_LITTLE_ENDIAN) { - memcpy(m,p,sizeof(*p)); + memcpy(m,p,sizeof(*p)); - #else + } else { - m->export_flags = pe_read_long(p->export_flags); - m->time_date_stamp = pe_read_long(p->time_date_stamp); + m->export_flags = pe_read_long(p->export_flags); + m->time_date_stamp = pe_read_long(p->time_date_stamp); - m->major_ver = pe_read_short(p->major_ver); - m->minor_ver = pe_read_short(p->minor_ver); + m->major_ver = pe_read_short(p->major_ver); + m->minor_ver = pe_read_short(p->minor_ver); - m->name_rva = pe_read_long(p->name_rva); - m->ordinal_base = pe_read_long(p->ordinal_base); - m->addr_tbl_entries = pe_read_long(p->addr_tbl_entries); - m->num_of_name_ptrs = pe_read_long(p->num_of_name_ptrs); - m->export_addr_tbl_rva = pe_read_long(p->export_addr_tbl_rva); - m->name_ptr_rva = pe_read_long(p->name_ptr_rva); - m->ordinal_tbl_rva = pe_read_long(p->ordinal_tbl_rva); + m->name_rva = pe_read_long(p->name_rva); + m->ordinal_base = pe_read_long(p->ordinal_base); + m->addr_tbl_entries = pe_read_long(p->addr_tbl_entries); + m->num_of_name_ptrs = pe_read_long(p->num_of_name_ptrs); + m->export_addr_tbl_rva = pe_read_long(p->export_addr_tbl_rva); + m->name_ptr_rva = pe_read_long(p->name_ptr_rva); + m->ordinal_tbl_rva = pe_read_long(p->ordinal_tbl_rva); - #endif + } return 0; } |