summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-01 08:13:48 -0500
committermidipix <writeonce@midipix.org>2016-12-01 08:13:48 -0500
commitd1e52dbb6e080d5ee8456ed686f5d4026370c7b4 (patch)
tree8aba1cf6f96b5dffa5a92dbcfba326321ce3ea6d
parent9740a33c5d6bb235cc3a4fa6e687ed35dd1b34cc (diff)
downloadperk-d1e52dbb6e080d5ee8456ed686f5d4026370c7b4.tar.bz2
perk-d1e52dbb6e080d5ee8456ed686f5d4026370c7b4.tar.xz
struct pe_{raw|meta}_export_hdr: member name normalization.
-rw-r--r--include/perk/perk_meta.h22
-rw-r--r--include/perk/perk_structs.h22
-rw-r--r--src/logic/pe_get_image_meta.c10
-rw-r--r--src/output/pe_output_export_symbols.c4
-rw-r--r--src/reader/pe_read_export_header.c22
5 files changed, 40 insertions, 40 deletions
diff --git a/include/perk/perk_meta.h b/include/perk/perk_meta.h
index 9181782..1646bb0 100644
--- a/include/perk/perk_meta.h
+++ b/include/perk/perk_meta.h
@@ -198,17 +198,17 @@ struct pe_meta_sec_hdr {
/* .edata section header*/
struct pe_meta_export_hdr {
- uint32_t export_flags;
- uint32_t time_date_stamp;
- uint16_t major_ver;
- uint16_t minor_ver;
- uint32_t name_rva;
- uint32_t ordinal_base;
- uint32_t addr_tbl_entries;
- uint32_t num_of_name_ptrs;
- uint32_t export_addr_tbl_rva;
- uint32_t name_ptr_rva;
- uint32_t ordinal_tbl_rva;
+ uint32_t eh_export_flags;
+ uint32_t eh_time_date_stamp;
+ uint16_t eh_major_ver;
+ uint16_t eh_minor_ver;
+ uint32_t eh_name_rva;
+ uint32_t eh_ordinal_base;
+ uint32_t eh_addr_tbl_entries;
+ uint32_t eh_num_of_name_ptrs;
+ uint32_t eh_export_addr_tbl_rva;
+ uint32_t eh_name_ptr_rva;
+ uint32_t eh_ordinal_tbl_rva;
};
diff --git a/include/perk/perk_structs.h b/include/perk/perk_structs.h
index 0256030..7e03d4e 100644
--- a/include/perk/perk_structs.h
+++ b/include/perk/perk_structs.h
@@ -244,17 +244,17 @@ struct pe_raw_sec_hdr {
struct pe_raw_export_hdr {
- unsigned char export_flags [0x04]; /* 0x00 */
- unsigned char time_date_stamp [0x04]; /* 0x04 */
- unsigned char major_ver [0x02]; /* 0x08 */
- unsigned char minor_ver [0x02]; /* 0x0a */
- unsigned char name_rva [0x04]; /* 0x0c */
- unsigned char ordinal_base [0x04]; /* 0x10 */
- unsigned char addr_tbl_entries [0x04]; /* 0x14 */
- unsigned char num_of_name_ptrs [0x04]; /* 0x18 */
- unsigned char export_addr_tbl_rva [0x04]; /* 0x1c */
- unsigned char name_ptr_rva [0x04]; /* 0x20 */
- unsigned char ordinal_tbl_rva [0x04]; /* 0x24 */
+ unsigned char eh_export_flags [0x04]; /* 0x00 */
+ unsigned char eh_time_date_stamp [0x04]; /* 0x04 */
+ unsigned char eh_major_ver [0x02]; /* 0x08 */
+ unsigned char eh_minor_ver [0x02]; /* 0x0a */
+ unsigned char eh_name_rva [0x04]; /* 0x0c */
+ unsigned char eh_ordinal_base [0x04]; /* 0x10 */
+ unsigned char eh_addr_tbl_entries [0x04]; /* 0x14 */
+ unsigned char eh_num_of_name_ptrs [0x04]; /* 0x18 */
+ unsigned char eh_export_addr_tbl_rva [0x04]; /* 0x1c */
+ unsigned char eh_name_ptr_rva [0x04]; /* 0x20 */
+ unsigned char eh_ordinal_tbl_rva [0x04]; /* 0x24 */
};
diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c
index a3f9219..9353ac4 100644
--- a/src/logic/pe_get_image_meta.c
+++ b/src/logic/pe_get_image_meta.c
@@ -113,9 +113,9 @@ int pe_get_expsym_by_name(
unsigned i;
offset = m->hedata->sh_virtual_addr - m->hedata->sh_ptr_to_raw_data;
- symrva = (uint32_t *)((uintptr_t)m->image.addr + (m->edata.name_ptr_rva - offset));
+ symrva = (uint32_t *)((uintptr_t)m->image.addr + (m->edata.eh_name_ptr_rva - offset));
- for (i=0; i<m->edata.num_of_name_ptrs; i++) {
+ for (i=0; i<m->edata.eh_num_of_name_ptrs; i++) {
sym = (const char *)m->image.addr + symrva[i] - offset;
if (!(strcmp(sym,name))) {
@@ -142,12 +142,12 @@ int pe_get_expsym_by_index(
uint32_t * symrva;
uintptr_t symaddr;
- if (index >= m->edata.num_of_name_ptrs)
+ if (index >= m->edata.eh_num_of_name_ptrs)
return -1;
if (expsym) {
offset = m->hedata->sh_virtual_addr - m->hedata->sh_ptr_to_raw_data;
- symrva = (uint32_t *)((uintptr_t)m->image.addr + (m->edata.name_ptr_rva - offset));
+ symrva = (uint32_t *)((uintptr_t)m->image.addr + (m->edata.eh_name_ptr_rva - offset));
symaddr = (uintptr_t)m->image.addr + symrva[index] - offset;
expsym->name = (const char *)symaddr;
@@ -238,7 +238,7 @@ int pe_get_image_meta(
if (m->aedata) {
pe_read_export_header(m->aedata,&m->edata);
- m->summary.nexpsyms = m->edata.num_of_name_ptrs;
+ m->summary.nexpsyms = m->edata.eh_num_of_name_ptrs;
}
/* .idata */
diff --git a/src/output/pe_output_export_symbols.c b/src/output/pe_output_export_symbols.c
index 6d98f75..118f865 100644
--- a/src/output/pe_output_export_symbols.c
+++ b/src/output/pe_output_export_symbols.c
@@ -53,9 +53,9 @@ int pe_output_export_symbols(
mark = m->image.addr;
offset = m->hedata->sh_virtual_addr - m->hedata->sh_ptr_to_raw_data;
- symrva = (uint32_t *)(mark + m->edata.name_ptr_rva - offset);
+ symrva = (uint32_t *)(mark + m->edata.eh_name_ptr_rva - offset);
- for (i=0; i<m->edata.num_of_name_ptrs; i++)
+ for (i=0; i<m->edata.eh_num_of_name_ptrs; i++)
if ((pretty_export_item(
cctx,
&mark[symrva[i] - offset],
diff --git a/src/reader/pe_read_export_header.c b/src/reader/pe_read_export_header.c
index 47dab66..758eb69 100644
--- a/src/reader/pe_read_export_header.c
+++ b/src/reader/pe_read_export_header.c
@@ -12,19 +12,19 @@
int pe_read_export_header(const struct pe_raw_export_hdr * p, struct pe_meta_export_hdr * m)
{
- m->export_flags = pe_read_long(p->export_flags);
- m->time_date_stamp = pe_read_long(p->time_date_stamp);
+ m->eh_export_flags = pe_read_long(p->eh_export_flags);
+ m->eh_time_date_stamp = pe_read_long(p->eh_time_date_stamp);
- m->major_ver = pe_read_short(p->major_ver);
- m->minor_ver = pe_read_short(p->minor_ver);
+ m->eh_major_ver = pe_read_short(p->eh_major_ver);
+ m->eh_minor_ver = pe_read_short(p->eh_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->eh_name_rva = pe_read_long(p->eh_name_rva);
+ m->eh_ordinal_base = pe_read_long(p->eh_ordinal_base);
+ m->eh_addr_tbl_entries = pe_read_long(p->eh_addr_tbl_entries);
+ m->eh_num_of_name_ptrs = pe_read_long(p->eh_num_of_name_ptrs);
+ m->eh_export_addr_tbl_rva = pe_read_long(p->eh_export_addr_tbl_rva);
+ m->eh_name_ptr_rva = pe_read_long(p->eh_name_ptr_rva);
+ m->eh_ordinal_tbl_rva = pe_read_long(p->eh_ordinal_tbl_rva);
return 0;
}