summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-12-13 10:51:31 -0500
committermidipix <writeonce@midipix.org>2017-12-13 11:24:14 -0500
commited06fbad97e24dea20e4240054f1cfeb15b15e92 (patch)
treea4c35a4c8beb782ebe56748e963066f62aa63eb5 /src/logic
parent068b8d92e7dbbda4dac003ef47d45b8beb4b5ad8 (diff)
downloadperk-ed06fbad97e24dea20e4240054f1cfeb15b15e92.tar.bz2
perk-ed06fbad97e24dea20e4240054f1cfeb15b15e92.tar.xz
refactor: struct pe_raw_image: members are now map-prefixed.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/pe_get_image_meta.c14
-rw-r--r--src/logic/pe_map_raw_image.c8
2 files changed, 11 insertions, 11 deletions
diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c
index c6d8f98..12a2658 100644
--- a/src/logic/pe_get_image_meta.c
+++ b/src/logic/pe_get_image_meta.c
@@ -119,10 +119,10 @@ int pe_get_expsym_by_name(
return -1;
offset = m->h_edata->sh_virtual_addr - m->h_edata->sh_ptr_to_raw_data;
- symrva = (uint32_t *)((uintptr_t)m->r_image.addr + (m->m_edata.eh_name_ptr_rva - offset));
+ symrva = (uint32_t *)((uintptr_t)m->r_image.map_addr + (m->m_edata.eh_name_ptr_rva - offset));
for (i=0; i<m->m_edata.eh_num_of_name_ptrs; i++) {
- sym = (const char *)m->r_image.addr + symrva[i] - offset;
+ sym = (const char *)m->r_image.map_addr + symrva[i] - offset;
if (!(strcmp(sym,name))) {
if (expsym) {
@@ -156,8 +156,8 @@ int pe_get_expsym_by_index(
if (expsym) {
offset = m->h_edata->sh_virtual_addr - m->h_edata->sh_ptr_to_raw_data;
- symrva = (uint32_t *)((uintptr_t)m->r_image.addr + (m->m_edata.eh_name_ptr_rva - offset));
- symaddr = (uintptr_t)m->r_image.addr + symrva[index] - offset;
+ symrva = (uint32_t *)((uintptr_t)m->r_image.map_addr + (m->m_edata.eh_name_ptr_rva - offset));
+ symaddr = (uintptr_t)m->r_image.map_addr + symrva[index] - offset;
expsym->name = (const char *)symaddr;
expsym->eaddr = 0;
@@ -181,7 +181,7 @@ int pe_get_image_meta(
struct pe_image_meta * m;
char * base;
- base = image->addr;
+ base = image->map_addr;
if (!(m = calloc(1,sizeof(*m))))
return PERK_SYSTEM_ERROR(dctx);
@@ -350,8 +350,8 @@ int pe_get_image_meta(
}
/* image */
- m->r_image.addr = image->addr;
- m->r_image.size = image->size;
+ m->r_image.map_addr = image->map_addr;
+ m->r_image.map_size = image->map_size;
/* all done */
*meta = m;
diff --git a/src/logic/pe_map_raw_image.c b/src/logic/pe_map_raw_image.c
index 1719e83..8334aa0 100644
--- a/src/logic/pe_map_raw_image.c
+++ b/src/logic/pe_map_raw_image.c
@@ -45,18 +45,18 @@ int pe_map_raw_image(
return PERK_CUSTOM_ERROR(
dctx,PERK_ERR_IMAGE_SIZE_ZERO);
- map->size = st.st_size;
- map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0);
+ map->map_size = st.st_size;
+ map->map_addr = mmap(0,map->map_size,prot,MAP_PRIVATE,fd,0);
if (fnew)
close(fd);
- return (map->addr == MAP_FAILED)
+ return (map->map_addr == MAP_FAILED)
? PERK_SYSTEM_ERROR(dctx)
: 0;
}
int pe_unmap_raw_image(struct pe_raw_image * map)
{
- return munmap(map->addr,map->size);
+ return munmap(map->map_addr,map->map_size);
}