diff options
author | midipix <writeonce@midipix.org> | 2016-05-06 10:06:28 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-10 23:35:44 -0500 |
commit | 8d8242d854343bc5e252b6e91967a309792122df (patch) | |
tree | b9aa44539788745518845afa9909f367c30bd953 /src/reader | |
parent | 2d6c77772c5d23f8d005dbb7d9749b9a84d6606a (diff) | |
download | perk-8d8242d854343bc5e252b6e91967a309792122df.tar.bz2 perk-8d8242d854343bc5e252b6e91967a309792122df.tar.xz |
pe_read_section_header(): integrate runtime little endian test.
Diffstat (limited to 'src/reader')
-rw-r--r-- | src/reader/pe_read_section_header.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/reader/pe_read_section_header.c b/src/reader/pe_read_section_header.c index e7c5d2f..f50454b 100644 --- a/src/reader/pe_read_section_header.c +++ b/src/reader/pe_read_section_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_section_header(const struct pe_sec_hdr * p, struct pe_meta_sec_hdr * m) @@ -19,25 +19,25 @@ int pe_read_section_header(const struct pe_sec_hdr * p, struct pe_meta_sec_hdr * /* todo: long name support */ m->long_name = 0; - #if (BYTE_ORDER == LITTLE_ENDIAN) + if (PERK_LITTLE_ENDIAN) { - memcpy(&m->virtual_size,&p->virtual_size,sizeof(*p)-sizeof(p->name)); + memcpy(&m->virtual_size,&p->virtual_size,sizeof(*p)-sizeof(p->name)); - #else + } else { - m->virtual_size = pe_read_long(p->virtual_size); - m->virtual_addr = pe_read_long(p->virtual_addr); - m->size_of_raw_data = pe_read_long(p->size_of_raw_data); - m->ptr_to_raw_data = pe_read_long(p->ptr_to_raw_data); - m->ptr_to_relocs = pe_read_long(p->ptr_to_relocs); - m->ptr_to_line_nums = pe_read_long(p->ptr_to_line_nums); + m->virtual_size = pe_read_long(p->virtual_size); + m->virtual_addr = pe_read_long(p->virtual_addr); + m->size_of_raw_data = pe_read_long(p->size_of_raw_data); + m->ptr_to_raw_data = pe_read_long(p->ptr_to_raw_data); + m->ptr_to_relocs = pe_read_long(p->ptr_to_relocs); + m->ptr_to_line_nums = pe_read_long(p->ptr_to_line_nums); - m->num_of_relocs = pe_read_short(p->num_of_relocs); - m->num_of_line_nums = pe_read_short(p->num_of_line_nums); + m->num_of_relocs = pe_read_short(p->num_of_relocs); + m->num_of_line_nums = pe_read_short(p->num_of_line_nums); - m->characteristics = pe_read_long(p->characteristics); + m->characteristics = pe_read_long(p->characteristics); - #endif + } return 0; } |