diff options
author | midipix <writeonce@midipix.org> | 2016-11-30 19:09:35 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-11-30 19:09:35 -0500 |
commit | da15f0c6fa6f1feed4951a5415d68e3de2b144a8 (patch) | |
tree | 275be2a454851e31e1bd74e0da0a974a19caa10c /src | |
parent | 511ffa02175b10bf934f57e95f77e3a410d587fb (diff) | |
download | perk-da15f0c6fa6f1feed4951a5415d68e3de2b144a8.tar.bz2 perk-da15f0c6fa6f1feed4951a5415d68e3de2b144a8.tar.xz |
struct pe_{raw|meta}_coff_file_hdr: member name normalization.
Diffstat (limited to 'src')
-rw-r--r-- | src/info/pe_get_image_subtype.c | 2 | ||||
-rw-r--r-- | src/logic/pe_get_image_meta.c | 30 | ||||
-rw-r--r-- | src/output/pe_output_image_sections.c | 2 | ||||
-rw-r--r-- | src/output/pe_output_image_strings.c | 4 | ||||
-rw-r--r-- | src/output/pe_output_image_symbols.c | 4 | ||||
-rw-r--r-- | src/reader/pe_read_coff_header.c | 26 | ||||
-rw-r--r-- | src/reader/pe_read_coff_symbol.c | 4 |
7 files changed, 36 insertions, 36 deletions
diff --git a/src/info/pe_get_image_subtype.c b/src/info/pe_get_image_subtype.c index 391fca3..df1ffd0 100644 --- a/src/info/pe_get_image_subtype.c +++ b/src/info/pe_get_image_subtype.c @@ -22,7 +22,7 @@ int pe_get_image_subtype(const struct pe_image_meta * m, struct pe_info_string * { int subtype; - if (m->coff.characteristics & PE_IMAGE_FILE_DLL) + if (m->coff.cfh_characteristics & PE_IMAGE_FILE_DLL) subtype = PE_SUBTYPE_DLL; else diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c index ec7ad82..bb461ff 100644 --- a/src/logic/pe_get_image_meta.c +++ b/src/logic/pe_get_image_meta.c @@ -36,7 +36,7 @@ void pe_free_image_meta(struct pe_image_meta * meta) int pe_get_named_section_index(const struct pe_image_meta * m, const char * name) { - int i; for (i=0; i<m->coff.num_of_sections; i++) + int i; for (i=0; i<m->coff.cfh_num_of_sections; i++) if (!(strcmp(name,m->sectbl[i].name))) return i; @@ -48,7 +48,7 @@ int pe_get_block_section_index(const struct pe_image_meta * m, const struct pe_b int i; uint32_t low,high; - for (i=0; i<m->coff.num_of_sections; i++) { + for (i=0; i<m->coff.cfh_num_of_sections; i++) { low = m->sectbl[i].virtual_addr; high = low + m->sectbl[i].virtual_size; @@ -64,7 +64,7 @@ int pe_get_roffset_from_rva(const struct pe_image_meta * m, uint32_t rva, uint32 int i; uint32_t low,high; - for (i=0; i<m->coff.num_of_sections; i++) { + for (i=0; i<m->coff.cfh_num_of_sections; i++) { low = m->sectbl[i].virtual_addr; high = low + m->sectbl[i].virtual_size; @@ -82,7 +82,7 @@ int pe_get_rva_from_roffset(const struct pe_image_meta * m, uint32_t roffset, ui int i; uint32_t low,high,ref; - for (i=0, ref=~0; i<m->coff.num_of_sections; i++) { + for (i=0, ref=~0; i<m->coff.cfh_num_of_sections; i++) { low = m->sectbl[i].ptr_to_raw_data; high = low + m->sectbl[i].virtual_size; @@ -189,14 +189,14 @@ int pe_get_image_meta( return pe_free_image_meta_impl( m,PERK_CUSTOM_ERROR(dctx,ret)); - mark = (const unsigned char *)image->addr + m->coff.ptr_to_sym_tbl; - mark += m->coff.num_of_syms * sizeof(struct pe_raw_coff_symbol); + mark = (const unsigned char *)image->addr + m->coff.cfh_ptr_to_sym_tbl; + mark += m->coff.cfh_num_of_syms * sizeof(struct pe_raw_coff_symbol); - m->coff.ptr_to_string_tbl = m->coff.ptr_to_sym_tbl; - m->coff.ptr_to_string_tbl += m->coff.num_of_syms * sizeof(struct pe_raw_coff_symbol); - m->coff.size_of_string_tbl = pe_read_long(mark); + m->coff.cfh_ptr_to_str_tbl = m->coff.cfh_ptr_to_sym_tbl; + m->coff.cfh_ptr_to_str_tbl += m->coff.cfh_num_of_syms * sizeof(struct pe_raw_coff_symbol); + m->coff.cfh_size_of_str_tbl = pe_read_long(mark); - mark = &m->acoff->signature[0]; + mark = &m->acoff->cfh_signature[0]; m->aopt = (union pe_raw_opt_hdr *)(mark + sizeof(*m->acoff)); if ((ret = (pe_read_optional_header(m->aopt,&m->opt)))) @@ -204,19 +204,19 @@ int pe_get_image_meta( m,PERK_CUSTOM_ERROR(dctx,ret)); mark = &m->aopt->opt_hdr_32.magic[0]; - m->asectbl = (struct pe_raw_sec_hdr *)(mark + m->coff.size_of_opt_hdr); + m->asectbl = (struct pe_raw_sec_hdr *)(mark + m->coff.cfh_size_of_opt_hdr); - if (!(m->sectbl = calloc(m->coff.num_of_sections,sizeof(*(m->sectbl))))) + if (!(m->sectbl = calloc(m->coff.cfh_num_of_sections,sizeof(*(m->sectbl))))) return pe_free_image_meta_impl( m,PERK_SYSTEM_ERROR(dctx)); - for (i=0; i<m->coff.num_of_sections; i++) { + for (i=0; i<m->coff.cfh_num_of_sections; i++) { pe_read_section_header(&m->asectbl[i],&m->sectbl[i]); if (m->sectbl[i].name[0] == '/') if ((l = strtol(&m->sectbl[i].name[1],0,10)) > 0) - if (l < m->coff.size_of_string_tbl) - m->sectbl[i].long_name = base + m->coff.ptr_to_string_tbl + l; + if (l < m->coff.cfh_size_of_str_tbl) + m->sectbl[i].long_name = base + m->coff.cfh_ptr_to_str_tbl + l; } /* .edata */ diff --git a/src/output/pe_output_image_sections.c b/src/output/pe_output_image_sections.c index b538cdf..67f0108 100644 --- a/src/output/pe_output_image_sections.c +++ b/src/output/pe_output_image_sections.c @@ -28,7 +28,7 @@ int pe_output_image_sections( dash = "- "; } - for (i=0; i<meta->coff.num_of_sections; i++) + for (i=0; i<meta->coff.cfh_num_of_sections; i++) if (fprintf(fout,"%s%s\n", dash, meta->sectbl[i].long_name diff --git a/src/output/pe_output_image_strings.c b/src/output/pe_output_image_strings.c index a2b16fa..b0555eb 100644 --- a/src/output/pe_output_image_strings.c +++ b/src/output/pe_output_image_strings.c @@ -33,9 +33,9 @@ int pe_output_image_strings( } mark = (char *)meta->image.addr; - mark += meta->coff.ptr_to_string_tbl; + mark += meta->coff.cfh_ptr_to_str_tbl; - cap = mark + meta->coff.size_of_string_tbl; + cap = mark + meta->coff.cfh_size_of_str_tbl; mark += sizeof(uint32_t); for (ch=mark; ch<cap; ) { diff --git a/src/output/pe_output_image_symbols.c b/src/output/pe_output_image_symbols.c index 3dc7eb3..7282436 100644 --- a/src/output/pe_output_image_symbols.c +++ b/src/output/pe_output_image_symbols.c @@ -34,9 +34,9 @@ int pe_output_image_symbols( } mark = (char *)meta->image.addr; - symtbl = (struct pe_raw_coff_symbol *)(mark + meta->coff.ptr_to_sym_tbl); + symtbl = (struct pe_raw_coff_symbol *)(mark + meta->coff.cfh_ptr_to_sym_tbl); - for (i=0; i<meta->coff.num_of_syms; i++) { + for (i=0; i<meta->coff.cfh_num_of_syms; i++) { pe_read_coff_symbol( &symtbl[i],&symrec, &meta->coff,meta->image.addr); diff --git a/src/reader/pe_read_coff_header.c b/src/reader/pe_read_coff_header.c index 1b4dfe3..12268f1 100644 --- a/src/reader/pe_read_coff_header.c +++ b/src/reader/pe_read_coff_header.c @@ -12,24 +12,24 @@ int pe_read_coff_header(const struct pe_raw_coff_file_hdr * p, struct pe_meta_coff_file_hdr * m) { - if ((p->signature[0] != 'P') || (p->signature[1] != 'E') - || p->signature[2] || p->signature[3]) + if ((p->cfh_signature[0] != 'P') || (p->cfh_signature[1] != 'E') + || p->cfh_signature[2] || p->cfh_signature[3]) return PERK_ERR_BAD_COFF_HEADER; - m->signature[0] = p->signature[0]; - m->signature[1] = p->signature[1]; - m->signature[2] = p->signature[2]; - m->signature[3] = p->signature[3]; + m->cfh_signature[0] = p->cfh_signature[0]; + m->cfh_signature[1] = p->cfh_signature[1]; + m->cfh_signature[2] = p->cfh_signature[2]; + m->cfh_signature[3] = p->cfh_signature[3]; - m->machine = pe_read_short(p->machine); - m->num_of_sections = pe_read_short(p->num_of_sections); + m->cfh_machine = pe_read_short(p->cfh_machine); + m->cfh_num_of_sections = pe_read_short(p->cfh_num_of_sections); - m->time_date_stamp = pe_read_long(p->time_date_stamp); - m->ptr_to_sym_tbl = pe_read_long(p->ptr_to_sym_tbl); - m->num_of_syms = pe_read_long(p->num_of_syms); + m->cfh_time_date_stamp = pe_read_long(p->cfh_time_date_stamp); + m->cfh_ptr_to_sym_tbl = pe_read_long(p->cfh_ptr_to_sym_tbl); + m->cfh_num_of_syms = pe_read_long(p->cfh_num_of_syms); - m->size_of_opt_hdr = pe_read_short(p->size_of_opt_hdr); - m->characteristics = pe_read_short(p->characteristics); + m->cfh_size_of_opt_hdr = pe_read_short(p->cfh_size_of_opt_hdr); + m->cfh_characteristics = pe_read_short(p->cfh_characteristics); return 0; } diff --git a/src/reader/pe_read_coff_symbol.c b/src/reader/pe_read_coff_symbol.c index 259f370..0c6a40d 100644 --- a/src/reader/pe_read_coff_symbol.c +++ b/src/reader/pe_read_coff_symbol.c @@ -47,8 +47,8 @@ int pe_read_coff_symbol( mark = (char *)base; roffset = pe_read_long(&p->name[4]); - if (roffset < coff->size_of_string_tbl) - m->long_name = mark + coff->ptr_to_string_tbl + roffset; + if (roffset < coff->cfh_size_of_str_tbl) + m->long_name = mark + coff->cfh_ptr_to_str_tbl + roffset; } return 0; |