summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/perk/perk.h6
-rw-r--r--include/perk/perk_meta.h2
-rw-r--r--include/perk/perk_structs.h6
-rw-r--r--src/logic/pe_get_image_meta.c14
-rw-r--r--src/reader/pe_read_import_header.c4
5 files changed, 16 insertions, 16 deletions
diff --git a/include/perk/perk.h b/include/perk/perk.h
index 81d396d..8bffb59 100644
--- a/include/perk/perk.h
+++ b/include/perk/perk.h
@@ -103,12 +103,12 @@ struct pe_image_meta {
union pe_raw_opt_hdr * aopt;
struct pe_raw_sec_hdr * asectbl;
struct pe_raw_export_hdr * aedata;
+ struct pe_raw_import_hdr * aidata;
struct pe_meta_export_hdr edata;
struct pe_meta_sec_hdr * hedata;
struct pe_meta_import_hdr * idata;
- struct pe_import_hdr * aidata;
struct pe_meta_sec_hdr * hidata;
};
@@ -201,12 +201,12 @@ perk_api int pe_read_coff_header (const struct pe_raw_coff_file_hdr *, struct p
perk_api int pe_read_optional_header (const union pe_raw_opt_hdr *, struct pe_meta_opt_hdr *);
perk_api int pe_read_section_header (const struct pe_raw_sec_hdr *, struct pe_meta_sec_hdr *);
perk_api int pe_read_export_header (const struct pe_raw_export_hdr *, struct pe_meta_export_hdr *);
-perk_api int pe_read_import_header (const struct pe_import_hdr *, struct pe_meta_import_hdr *);
+perk_api int pe_read_import_header (const struct pe_raw_import_hdr *, struct pe_meta_import_hdr *);
perk_api int pe_read_coff_symbol (const struct pe_coff_symbol *, struct pe_meta_coff_symbol *,
const struct pe_meta_coff_file_hdr *, void * base);
-perk_api int pe_read_import_lookup (const union pe_import_lookup *, struct pe_meta_import_lookup *,
+perk_api int pe_read_import_lookup (const union pe_raw_import_lookup *, struct pe_meta_import_lookup *,
uint32_t magic);
#ifdef __cplusplus
diff --git a/include/perk/perk_meta.h b/include/perk/perk_meta.h
index ea55b51..b3b5411 100644
--- a/include/perk/perk_meta.h
+++ b/include/perk/perk_meta.h
@@ -244,7 +244,7 @@ struct pe_meta_import_hdr {
uint32_t count;
char * name;
struct pe_meta_import_lookup * items;
- union pe_import_lookup * aitems;
+ union pe_raw_import_lookup * aitems;
};
diff --git a/include/perk/perk_structs.h b/include/perk/perk_structs.h
index 1eaf8a7..7113409 100644
--- a/include/perk/perk_structs.h
+++ b/include/perk/perk_structs.h
@@ -264,7 +264,7 @@ union pe_raw_export_addr_tbl {
};
-union pe_import_lookup {
+union pe_raw_import_lookup {
unsigned char import_lookup_entry_64 [0x08]; /* 0x00 */
unsigned char import_lookup_entry_32 [0x04]; /* 0x00 */
unsigned char hint_name_tbl_rva [0x04]; /* 0x00 */
@@ -272,7 +272,7 @@ union pe_import_lookup {
};
-struct pe_import_hdr {
+struct pe_raw_import_hdr {
unsigned char import_lookup_tbl_rva [0x04]; /* 0x00 */
unsigned char time_date_stamp [0x04]; /* 0x04 */
unsigned char forwarder_chain [0x04]; /* 0x08 */
@@ -281,7 +281,7 @@ struct pe_import_hdr {
};
-struct pe_hint_name_entry {
+struct pe_raw_hint_name_entry {
unsigned char hint [0x02]; /* 0x00 */
unsigned char name [0x02]; /* 0x02 */
};
diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c
index 0a8de47..20ab387 100644
--- a/src/logic/pe_get_image_meta.c
+++ b/src/logic/pe_get_image_meta.c
@@ -242,8 +242,8 @@ int pe_get_image_meta(
}
/* .idata */
- struct pe_import_hdr * pidata;
- union pe_import_lookup * pitem;
+ struct pe_raw_import_hdr * pidata;
+ union pe_raw_import_lookup * pitem;
i = pe_get_named_section_index(m,".idata");
s = pe_get_block_section_index(m,&m->opt.dirs.import_tbl);
@@ -254,11 +254,11 @@ int pe_get_image_meta(
if (s >= 0) {
m->hidata = &m->sectbl[s];
- m->aidata = (struct pe_import_hdr *)(base + m->sectbl[s].ptr_to_raw_data
+ m->aidata = (struct pe_raw_import_hdr *)(base + m->sectbl[s].ptr_to_raw_data
+ m->opt.dirs.import_tbl.rva - m->sectbl[s].virtual_addr);
} else if (i >= 0) {
m->hidata = &m->sectbl[i];
- m->aidata = (struct pe_import_hdr *)(base + m->sectbl[i].ptr_to_raw_data);
+ m->aidata = (struct pe_raw_import_hdr *)(base + m->sectbl[i].ptr_to_raw_data);
}
if (m->aidata) {
@@ -278,7 +278,7 @@ int pe_get_image_meta(
+ m->idata[i].name_rva - m->hidata->virtual_addr;
if (m->idata[i].import_lookup_tbl_rva)
- m->idata[i].aitems = (union pe_import_lookup *)(base + m->hidata->ptr_to_raw_data
+ m->idata[i].aitems = (union pe_raw_import_lookup *)(base + m->hidata->ptr_to_raw_data
+ m->idata[i].import_lookup_tbl_rva - m->hidata->virtual_addr);
/* items */
@@ -316,8 +316,8 @@ int pe_get_image_meta(
}
if (!m->idata[i].items[j].flags) {
- struct pe_hint_name_entry * pentry =
- (struct pe_hint_name_entry *)(base + m->hidata->ptr_to_raw_data
+ struct pe_raw_hint_name_entry * pentry =
+ (struct pe_raw_hint_name_entry *)(base + m->hidata->ptr_to_raw_data
+ m->idata[i].items[j].u.hint_name_tbl_rva - m->hidata->virtual_addr);
m->idata[i].items[j].name = (char *)pentry->name;
diff --git a/src/reader/pe_read_import_header.c b/src/reader/pe_read_import_header.c
index e656185..624313b 100644
--- a/src/reader/pe_read_import_header.c
+++ b/src/reader/pe_read_import_header.c
@@ -10,7 +10,7 @@
#include "perk_endian_impl.h"
#include "perk_reader_impl.h"
-int pe_read_import_header(const struct pe_import_hdr * p, struct pe_meta_import_hdr * m)
+int pe_read_import_header(const struct pe_raw_import_hdr * p, struct pe_meta_import_hdr * m)
{
m->import_lookup_tbl_rva = pe_read_long(p->import_lookup_tbl_rva);
m->time_date_stamp = pe_read_long(p->time_date_stamp);
@@ -25,7 +25,7 @@ int pe_read_import_header(const struct pe_import_hdr * p, struct pe_meta_import_
}
int pe_read_import_lookup(
- const union pe_import_lookup * p,
+ const union pe_raw_import_lookup * p,
struct pe_meta_import_lookup * m,
uint32_t magic)
{