diff options
Diffstat (limited to 'src/reader')
-rw-r--r-- | src/reader/pe_read_coff_header.c | 2 | ||||
-rw-r--r-- | src/reader/pe_read_dos_header.c | 6 | ||||
-rw-r--r-- | src/reader/pe_read_export_header.c | 2 | ||||
-rw-r--r-- | src/reader/pe_read_import_header.c | 8 | ||||
-rw-r--r-- | src/reader/pe_read_optional_header.c | 30 | ||||
-rw-r--r-- | src/reader/pe_read_section_header.c | 4 |
6 files changed, 26 insertions, 26 deletions
diff --git a/src/reader/pe_read_coff_header.c b/src/reader/pe_read_coff_header.c index e7bdf8a..cc466be 100644 --- a/src/reader/pe_read_coff_header.c +++ b/src/reader/pe_read_coff_header.c @@ -34,4 +34,4 @@ int pe_read_coff_header(const struct pe_coff_file_hdr * p, struct pe_meta_coff_f #endif return 0; -}; +} diff --git a/src/reader/pe_read_dos_header.c b/src/reader/pe_read_dos_header.c index 75b7d31..5f8b14a 100644 --- a/src/reader/pe_read_dos_header.c +++ b/src/reader/pe_read_dos_header.c @@ -6,8 +6,6 @@ int pe_read_dos_header(const struct pe_image_dos_hdr * p, struct pe_meta_image_dos_hdr * m) { - int i; - if ((p->dos_magic[0] != 'M') || (p->dos_magic[1] != 'Z')) return PERK_BAD_DOS_HEADER; @@ -17,6 +15,8 @@ int pe_read_dos_header(const struct pe_image_dos_hdr * p, struct pe_meta_image_d #else + int i; + m->dos_magic[0] = p->dos_magic[0]; m->dos_magic[1] = p->dos_magic[1]; @@ -49,4 +49,4 @@ int pe_read_dos_header(const struct pe_image_dos_hdr * p, struct pe_meta_image_d #endif return 0; -}; +} diff --git a/src/reader/pe_read_export_header.c b/src/reader/pe_read_export_header.c index 6a959c9..97272f4 100644 --- a/src/reader/pe_read_export_header.c +++ b/src/reader/pe_read_export_header.c @@ -29,4 +29,4 @@ int pe_read_export_header(const struct pe_export_hdr * p, struct pe_meta_export_ #endif return 0; -}; +} diff --git a/src/reader/pe_read_import_header.c b/src/reader/pe_read_import_header.c index 7d71143..50434e4 100644 --- a/src/reader/pe_read_import_header.c +++ b/src/reader/pe_read_import_header.c @@ -14,9 +14,9 @@ int pe_read_import_header(const struct pe_import_hdr * p, struct pe_meta_import_ m->import_lookup_tbl_rva = pe_read_long(p->import_lookup_tbl_rva); m->time_date_stamp = pe_read_long(p->time_date_stamp); - m->forwarder_chain = pe_read_long(p>forwarder_chain); + m->forwarder_chain = pe_read_long(p->forwarder_chain); m->name_rva = pe_read_long(p->name_rva); - m->import_addr_tbl_rva = pe_read_long(p>import_addr_tbl_rva); + m->import_addr_tbl_rva = pe_read_long(p->import_addr_tbl_rva); #endif @@ -24,7 +24,7 @@ int pe_read_import_header(const struct pe_import_hdr * p, struct pe_meta_import_ m->aitems = 0; return 0; -}; +} int pe_read_import_lookup_item( const struct pe_import_lookup_item * p, @@ -43,4 +43,4 @@ int pe_read_import_lookup_item( default: return PERK_BAD_IMAGE_TYPE; } -}; +} diff --git a/src/reader/pe_read_optional_header.c b/src/reader/pe_read_optional_header.c index 701c6a9..73443c6 100644 --- a/src/reader/pe_read_optional_header.c +++ b/src/reader/pe_read_optional_header.c @@ -6,14 +6,6 @@ int pe_read_optional_header(const union pe_opt_hdr * p, struct pe_meta_opt_hdr * m) { - struct pe_opt_hdr_std * astd; - struct pe_opt_hdr_vers * avers; - struct pe_opt_hdr_align * aalign; - struct pe_opt_hdr_img * aimg; - struct pe_opt_hdr_ldr * aldr; - struct pe_opt_hdr_dirs * adirs; - size_t sdirs; - m->std.magic = pe_read_short(p->opt_hdr_32.magic); memset(&m->dirs,0,sizeof(m->dirs)); @@ -54,20 +46,28 @@ int pe_read_optional_header(const union pe_opt_hdr * p, struct pe_meta_opt_hdr * #else + struct pe_opt_hdr_std * astd; + struct pe_opt_hdr_vers * avers; + struct pe_opt_hdr_align * aalign; + struct pe_opt_hdr_img * aimg; + struct pe_opt_hdr_ldr * aldr; + struct pe_opt_hdr_dirs * adirs; + size_t sdirs; + astd = (struct pe_opt_hdr_std *)p; switch (m->std.magic) { case PE_MAGIC_PE32: - avers = (struct pe_opt_hdr_std *)&p->opt_hdr_32.major_os_ver; - aalign = (struct pe_opt_hdr_std *)&p->opt_hdr_32.section_align; + avers = (struct pe_opt_hdr_vers *)&p->opt_hdr_32.major_os_ver; + aalign = (struct pe_opt_hdr_align *)&p->opt_hdr_32.section_align; aimg = (struct pe_opt_hdr_img *)&p->opt_hdr_32.size_of_image; aldr = (struct pe_opt_hdr_ldr *)&p->opt_hdr_32.loader_flags; adirs = (struct pe_opt_hdr_dirs *)&p->opt_hdr_32.export_tbl; break; case PE_MAGIC_PE32_PLUS: - avers = (struct pe_opt_hdr_std *)&p->opt_hdr_64.major_os_ver; - aalign = (struct pe_opt_hdr_std *)&p->opt_hdr_64.section_align; + avers = (struct pe_opt_hdr_vers *)&p->opt_hdr_64.major_os_ver; + aalign = (struct pe_opt_hdr_align *)&p->opt_hdr_64.section_align; aimg = (struct pe_opt_hdr_img *)&p->opt_hdr_64.size_of_image; aldr = (struct pe_opt_hdr_ldr *)&p->opt_hdr_64.loader_flags; adirs = (struct pe_opt_hdr_dirs *)&p->opt_hdr_64.export_tbl; @@ -78,8 +78,8 @@ int pe_read_optional_header(const union pe_opt_hdr * p, struct pe_meta_opt_hdr * } /* std */ - m->std.major_linker_ver = astd->major_linker_ver; - m->std.minor_linker_ver = astd->minor_linker_ver; + m->std.major_linker_ver = astd->major_linker_ver[0]; + m->std.minor_linker_ver = astd->minor_linker_ver[0]; m->std.size_of_code = pe_read_long(astd->size_of_code); m->std.size_of_initialized_data = pe_read_long(astd->size_of_initialized_data); @@ -136,4 +136,4 @@ int pe_read_optional_header(const union pe_opt_hdr * p, struct pe_meta_opt_hdr * }; return 0; -}; +} diff --git a/src/reader/pe_read_section_header.c b/src/reader/pe_read_section_header.c index 1a37f63..e6a1d19 100644 --- a/src/reader/pe_read_section_header.c +++ b/src/reader/pe_read_section_header.c @@ -24,7 +24,7 @@ int pe_read_section_header(const struct pe_sec_hdr * p, struct pe_meta_sec_hdr * 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_linu_nums); + 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); @@ -34,4 +34,4 @@ int pe_read_section_header(const struct pe_sec_hdr * p, struct pe_meta_sec_hdr * #endif return 0; -}; +} |