summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2017-12-13 08:55:19 -0500
committermidipix <writeonce@midipix.org>2017-12-13 11:24:14 -0500
commit58ced9c919a0fae75e98c937ac55f8e30fc01c6f (patch)
treee4c0e3aa9dd830dee0e874778d337d2ef44cad48
parent753060eae1596558287a306bcb7b70343c8a830e (diff)
downloadperk-58ced9c919a0fae75e98c937ac55f8e30fc01c6f.tar.bz2
perk-58ced9c919a0fae75e98c937ac55f8e30fc01c6f.tar.xz
refactor: struct pe_image_meta: meta members are now m-prefixed.
-rw-r--r--include/perk/perk.h16
-rw-r--r--src/info/pe_get_image_abi.c4
-rw-r--r--src/info/pe_get_image_framework.c16
-rw-r--r--src/info/pe_get_image_subsystem.c6
-rw-r--r--src/info/pe_get_image_subtype.c2
-rw-r--r--src/logic/pe_get_image_meta.c156
-rw-r--r--src/output/pe_output_export_symbols.c4
-rw-r--r--src/output/pe_output_image_sections.c8
-rw-r--r--src/output/pe_output_image_strings.c4
-rw-r--r--src/output/pe_output_image_symbols.c6
-rw-r--r--src/output/pe_output_import_libraries.c12
11 files changed, 117 insertions, 117 deletions
diff --git a/include/perk/perk.h b/include/perk/perk.h
index 79a0843..b207390 100644
--- a/include/perk/perk.h
+++ b/include/perk/perk.h
@@ -90,16 +90,16 @@ struct pe_meta_stats {
};
struct pe_image_meta {
- struct pe_meta_stats mstats;
- struct pe_meta_image_dos_hdr dos;
- struct pe_meta_coff_file_hdr coff;
- struct pe_meta_opt_hdr opt;
- struct pe_meta_sec_hdr * sectbl;
+ struct pe_meta_stats m_stats;
+ struct pe_meta_image_dos_hdr m_dos;
+ struct pe_meta_coff_file_hdr m_coff;
+ struct pe_meta_opt_hdr m_opt;
+ struct pe_meta_sec_hdr * m_sectbl;
- struct pe_meta_export_hdr edata;
- struct pe_meta_sec_hdr * hedata;
+ struct pe_meta_export_hdr m_edata;
+ struct pe_meta_import_hdr * m_idata;
- struct pe_meta_import_hdr * idata;
+ struct pe_meta_sec_hdr * hedata;
struct pe_meta_sec_hdr * hidata;
struct pe_raw_image image;
diff --git a/src/info/pe_get_image_abi.c b/src/info/pe_get_image_abi.c
index 8fd7499..7d9b972 100644
--- a/src/info/pe_get_image_abi.c
+++ b/src/info/pe_get_image_abi.c
@@ -20,7 +20,7 @@ int pe_get_image_abi(const struct pe_image_meta * m, struct pe_info_string * inf
int abi;
if (m->aobj) {
- switch (m->coff.cfh_machine) {
+ switch (m->m_coff.cfh_machine) {
case PE_IMAGE_FILE_MACHINE_I386:
abi = PE_ABI_PE32;
break;
@@ -35,7 +35,7 @@ int pe_get_image_abi(const struct pe_image_meta * m, struct pe_info_string * inf
break;
}
} else {
- switch (m->opt.oh_std.coh_magic) {
+ switch (m->m_opt.oh_std.coh_magic) {
case PE_MAGIC_PE32:
abi = PE_ABI_PE32;
break;
diff --git a/src/info/pe_get_image_framework.c b/src/info/pe_get_image_framework.c
index e19abd2..2a574fc 100644
--- a/src/info/pe_get_image_framework.c
+++ b/src/info/pe_get_image_framework.c
@@ -27,7 +27,7 @@ static const char * const pe_framework_str[PE_FRAMEWORK_CAP] = {
static bool pe_image_is_psxscl(const struct pe_image_meta * m)
{
- return (!m->mstats.nimplibs
+ return (!m->m_stats.nimplibs
&& !pe_get_expsym_by_name(m,"__psx_init",0));
}
@@ -35,8 +35,8 @@ static bool pe_image_is_cygwin(const struct pe_image_meta * m)
{
int i;
- for (i=0; i<m->mstats.nimplibs; i++)
- if (!(strcmp(m->idata[i].ih_name,"cygwin1.dll")))
+ for (i=0; i<m->m_stats.nimplibs; i++)
+ if (!(strcmp(m->m_idata[i].ih_name,"cygwin1.dll")))
return true;
return false;
@@ -46,8 +46,8 @@ static bool pe_image_is_msys(const struct pe_image_meta * m)
{
int i;
- for (i=0; i<m->mstats.nimplibs; i++)
- if (!(strcmp(m->idata[i].ih_name,"msys-2.0.dll")))
+ for (i=0; i<m->m_stats.nimplibs; i++)
+ if (!(strcmp(m->m_idata[i].ih_name,"msys-2.0.dll")))
return true;
return false;
@@ -85,13 +85,13 @@ int pe_get_image_framework(const struct pe_image_meta * m, struct pe_info_string
else if (pe_image_is_mingw(m))
framework = PE_FRAMEWORK_MINGW;
- else if (m->opt.oh_img.coh_subsystem == PE_IMAGE_SUBSYSTEM_POSIX_CUI)
+ else if (m->m_opt.oh_img.coh_subsystem == PE_IMAGE_SUBSYSTEM_POSIX_CUI)
framework = PE_FRAMEWORK_SUACON;
- else if (m->opt.oh_img.coh_subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_CUI)
+ else if (m->m_opt.oh_img.coh_subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_CUI)
framework = PE_FRAMEWORK_WINCON;
- else if (m->opt.oh_img.coh_subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_GUI)
+ else if (m->m_opt.oh_img.coh_subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_GUI)
framework = PE_FRAMEWORK_WIN32;
else
diff --git a/src/info/pe_get_image_subsystem.c b/src/info/pe_get_image_subsystem.c
index 7cbdf8b..135443e 100644
--- a/src/info/pe_get_image_subsystem.c
+++ b/src/info/pe_get_image_subsystem.c
@@ -29,14 +29,14 @@ int pe_get_image_subsystem(const struct pe_image_meta * m, struct pe_info_string
if (m->aobj)
subsystem = 0;
- else if (m->opt.oh_img.coh_subsystem >= 0x10)
+ else if (m->m_opt.oh_img.coh_subsystem >= 0x10)
subsystem = -1;
- else if (!pe_subsystem_str[m->opt.oh_img.coh_subsystem])
+ else if (!pe_subsystem_str[m->m_opt.oh_img.coh_subsystem])
subsystem = -1;
else
- subsystem = m->opt.oh_img.coh_subsystem;
+ subsystem = m->m_opt.oh_img.coh_subsystem;
if ((subsystem < 0) && infostr) {
strcpy(infostr->buffer,"INVALID");
diff --git a/src/info/pe_get_image_subtype.c b/src/info/pe_get_image_subtype.c
index bbb6363..2808881 100644
--- a/src/info/pe_get_image_subtype.c
+++ b/src/info/pe_get_image_subtype.c
@@ -25,7 +25,7 @@ int pe_get_image_subtype(const struct pe_image_meta * m, struct pe_info_string *
if (m->aobj)
subtype = PE_SUBTYPE_OBJ;
- else if (m->coff.cfh_characteristics & PE_IMAGE_FILE_DLL)
+ else if (m->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 412f06e..0bfc393 100644
--- a/src/logic/pe_get_image_meta.c
+++ b/src/logic/pe_get_image_meta.c
@@ -18,11 +18,11 @@ static int pe_free_image_meta_impl(struct pe_image_meta * meta, int ret)
int i;
if (meta) {
- for (i=0; i<meta->mstats.nimplibs; i++)
- free(meta->idata[i].ih_items);
+ for (i=0; i<meta->m_stats.nimplibs; i++)
+ free(meta->m_idata[i].ih_items);
- free(meta->idata);
- free(meta->sectbl);
+ free(meta->m_idata);
+ free(meta->m_sectbl);
free(meta);
}
@@ -36,8 +36,8 @@ 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.cfh_num_of_sections; i++)
- if (!(strcmp(name,m->sectbl[i].sh_name)))
+ int i; for (i=0; i<m->m_coff.cfh_num_of_sections; i++)
+ if (!(strcmp(name,m->m_sectbl[i].sh_name)))
return i;
return -1;
@@ -51,9 +51,9 @@ int pe_get_block_section_index(const struct pe_image_meta * m, const struct pe_b
if (m->aobj)
return -1;
- for (i=0; i<m->coff.cfh_num_of_sections; i++) {
- low = m->sectbl[i].sh_virtual_addr;
- high = low + m->sectbl[i].sh_virtual_size;
+ for (i=0; i<m->m_coff.cfh_num_of_sections; i++) {
+ low = m->m_sectbl[i].sh_virtual_addr;
+ high = low + m->m_sectbl[i].sh_virtual_size;
if ((block->dh_rva >= low) && (block->dh_rva + block->dh_size <= high))
return i;
@@ -67,12 +67,12 @@ 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.cfh_num_of_sections; i++) {
- low = m->sectbl[i].sh_virtual_addr;
- high = low + m->sectbl[i].sh_virtual_size;
+ for (i=0; i<m->m_coff.cfh_num_of_sections; i++) {
+ low = m->m_sectbl[i].sh_virtual_addr;
+ high = low + m->m_sectbl[i].sh_virtual_size;
if ((rva >= low) && (rva < high)) {
- *roffset = (rva - low) + m->sectbl[i].sh_ptr_to_raw_data;
+ *roffset = (rva - low) + m->m_sectbl[i].sh_ptr_to_raw_data;
return 0;
}
}
@@ -85,12 +85,12 @@ 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.cfh_num_of_sections; i++) {
- low = m->sectbl[i].sh_ptr_to_raw_data;
- high = low + m->sectbl[i].sh_virtual_size;
+ for (i=0, ref=~0; i<m->m_coff.cfh_num_of_sections; i++) {
+ low = m->m_sectbl[i].sh_ptr_to_raw_data;
+ high = low + m->m_sectbl[i].sh_virtual_size;
if ((roffset >= low) && (roffset < high)) {
- *rva = (roffset - low) + m->sectbl[i].sh_virtual_addr;
+ *rva = (roffset - low) + m->m_sectbl[i].sh_virtual_addr;
return 0;
} else if (ref > low) {
ref = low;
@@ -119,9 +119,9 @@ int pe_get_expsym_by_name(
return -1;
offset = m->hedata->sh_virtual_addr - m->hedata->sh_ptr_to_raw_data;
- symrva = (uint32_t *)((uintptr_t)m->image.addr + (m->edata.eh_name_ptr_rva - offset));
+ symrva = (uint32_t *)((uintptr_t)m->image.addr + (m->m_edata.eh_name_ptr_rva - offset));
- for (i=0; i<m->edata.eh_num_of_name_ptrs; i++) {
+ for (i=0; i<m->m_edata.eh_num_of_name_ptrs; i++) {
sym = (const char *)m->image.addr + symrva[i] - offset;
if (!(strcmp(sym,name))) {
@@ -151,12 +151,12 @@ int pe_get_expsym_by_index(
if (m->aobj)
return -1;
- if (index >= m->edata.eh_num_of_name_ptrs)
+ if (index >= m->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.eh_name_ptr_rva - offset));
+ symrva = (uint32_t *)((uintptr_t)m->image.addr + (m->m_edata.eh_name_ptr_rva - offset));
symaddr = (uintptr_t)m->image.addr + symrva[index] - offset;
expsym->name = (const char *)symaddr;
@@ -188,78 +188,78 @@ int pe_get_image_meta(
m->aobj = (struct pe_raw_coff_object_hdr *)base;
- if (pe_read_object_header(m->aobj,&m->coff)) {
+ if (pe_read_object_header(m->aobj,&m->m_coff)) {
m->aobj = 0;
m->ados = (struct pe_raw_image_dos_hdr *)base;
- if ((ret = (pe_read_dos_header(m->ados,&m->dos))))
+ if ((ret = (pe_read_dos_header(m->ados,&m->m_dos))))
return pe_free_image_meta_impl(
m,PERK_CUSTOM_ERROR(dctx,ret));
- m->acoff = (struct pe_raw_coff_image_hdr *)(base + m->dos.dos_lfanew);
+ m->acoff = (struct pe_raw_coff_image_hdr *)(base + m->m_dos.dos_lfanew);
- if ((ret = (pe_read_coff_header(m->acoff,&m->coff))))
+ if ((ret = (pe_read_coff_header(m->acoff,&m->m_coff))))
return pe_free_image_meta_impl(
m,PERK_CUSTOM_ERROR(dctx,ret));
}
- mark = (const unsigned char *)base + m->coff.cfh_ptr_to_sym_tbl;
- mark += m->coff.cfh_num_of_syms * sizeof(struct pe_raw_coff_symbol);
+ mark = (const unsigned char *)base + m->m_coff.cfh_ptr_to_sym_tbl;
+ mark += m->m_coff.cfh_num_of_syms * sizeof(struct pe_raw_coff_symbol);
- if (m->coff.cfh_ptr_to_sym_tbl) {
- 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);
+ if (m->m_coff.cfh_ptr_to_sym_tbl) {
+ m->m_coff.cfh_ptr_to_str_tbl = m->m_coff.cfh_ptr_to_sym_tbl;
+ m->m_coff.cfh_ptr_to_str_tbl += m->m_coff.cfh_num_of_syms * sizeof(struct pe_raw_coff_symbol);
+ m->m_coff.cfh_size_of_str_tbl = pe_read_long(mark);
}
if (m->ados) {
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))))
+ if ((ret = (pe_read_optional_header(m->aopt,&m->m_opt))))
return pe_free_image_meta_impl(
m,PERK_CUSTOM_ERROR(dctx,ret));
mark = &m->aopt->opt_hdr_32.coh_magic[0];
- m->asectbl = (struct pe_raw_sec_hdr *)(mark + m->coff.cfh_size_of_opt_hdr);
+ m->asectbl = (struct pe_raw_sec_hdr *)(mark + m->m_coff.cfh_size_of_opt_hdr);
} else {
mark = &m->aobj->cfh_machine[0];
m->asectbl = (struct pe_raw_sec_hdr *)(mark + sizeof(*m->aobj));
}
- if (!(m->sectbl = calloc(m->coff.cfh_num_of_sections,sizeof(*(m->sectbl)))))
+ if (!(m->m_sectbl = calloc(m->m_coff.cfh_num_of_sections,sizeof(*(m->m_sectbl)))))
return pe_free_image_meta_impl(
m,PERK_SYSTEM_ERROR(dctx));
- for (i=0; i<m->coff.cfh_num_of_sections; i++) {
- pe_read_section_header(&m->asectbl[i],&m->sectbl[i]);
+ for (i=0; i<m->m_coff.cfh_num_of_sections; i++) {
+ pe_read_section_header(&m->asectbl[i],&m->m_sectbl[i]);
- if (m->sectbl[i].sh_name[0] == '/')
- if ((l = strtol(&m->sectbl[i].sh_name[1],0,10)) > 0)
- if (l < m->coff.cfh_size_of_str_tbl)
- m->sectbl[i].sh_long_name = base + m->coff.cfh_ptr_to_str_tbl + l;
+ if (m->m_sectbl[i].sh_name[0] == '/')
+ if ((l = strtol(&m->m_sectbl[i].sh_name[1],0,10)) > 0)
+ if (l < m->m_coff.cfh_size_of_str_tbl)
+ m->m_sectbl[i].sh_long_name = base + m->m_coff.cfh_ptr_to_str_tbl + l;
}
/* .edata */
i = pe_get_named_section_index(m,".edata");
- s = pe_get_block_section_index(m,&m->opt.oh_dirs.coh_export_tbl);
+ s = pe_get_block_section_index(m,&m->m_opt.oh_dirs.coh_export_tbl);
if ((i >= 0) && (i != s))
return pe_free_image_meta_impl(
m,PERK_CUSTOM_ERROR(dctx,PERK_ERR_IMAGE_MALFORMED));
if (s >= 0) {
- m->hedata = &m->sectbl[s];
- m->aedata = (struct pe_raw_export_hdr *)(base + m->sectbl[s].sh_ptr_to_raw_data
- + m->opt.oh_dirs.coh_export_tbl.dh_rva - m->sectbl[s].sh_virtual_addr);
+ m->hedata = &m->m_sectbl[s];
+ m->aedata = (struct pe_raw_export_hdr *)(base + m->m_sectbl[s].sh_ptr_to_raw_data
+ + m->m_opt.oh_dirs.coh_export_tbl.dh_rva - m->m_sectbl[s].sh_virtual_addr);
} else if (i >= 0) {
- m->hedata = &m->sectbl[i];
- m->aedata = (struct pe_raw_export_hdr *)(base + m->sectbl[i].sh_ptr_to_raw_data);
+ m->hedata = &m->m_sectbl[i];
+ m->aedata = (struct pe_raw_export_hdr *)(base + m->m_sectbl[i].sh_ptr_to_raw_data);
}
if (m->aedata) {
- pe_read_export_header(m->aedata,&m->edata);
- m->mstats.nexpsyms = m->edata.eh_num_of_name_ptrs;
+ pe_read_export_header(m->aedata,&m->m_edata);
+ m->m_stats.nexpsyms = m->m_edata.eh_num_of_name_ptrs;
}
/* .idata */
@@ -267,83 +267,83 @@ int pe_get_image_meta(
union pe_raw_import_lookup * pitem;
i = pe_get_named_section_index(m,".idata");
- s = pe_get_block_section_index(m,&m->opt.oh_dirs.coh_import_tbl);
+ s = pe_get_block_section_index(m,&m->m_opt.oh_dirs.coh_import_tbl);
if ((i >= 0) && (i != s))
return pe_free_image_meta_impl(
m,PERK_CUSTOM_ERROR(dctx,PERK_ERR_IMAGE_MALFORMED));
if (s >= 0) {
- m->hidata = &m->sectbl[s];
- m->aidata = (struct pe_raw_import_hdr *)(base + m->sectbl[s].sh_ptr_to_raw_data
- + m->opt.oh_dirs.coh_import_tbl.dh_rva - m->sectbl[s].sh_virtual_addr);
+ m->hidata = &m->m_sectbl[s];
+ m->aidata = (struct pe_raw_import_hdr *)(base + m->m_sectbl[s].sh_ptr_to_raw_data
+ + m->m_opt.oh_dirs.coh_import_tbl.dh_rva - m->m_sectbl[s].sh_virtual_addr);
} else if (i >= 0) {
- m->hidata = &m->sectbl[i];
- m->aidata = (struct pe_raw_import_hdr *)(base + m->sectbl[i].sh_ptr_to_raw_data);
+ m->hidata = &m->m_sectbl[i];
+ m->aidata = (struct pe_raw_import_hdr *)(base + m->m_sectbl[i].sh_ptr_to_raw_data);
}
if (m->aidata) {
/* num of implibs */
for (pidata=m->aidata; pe_read_long(pidata->ih_name_rva); pidata++)
- m->mstats.nimplibs++;
+ m->m_stats.nimplibs++;
/* import headers */
- if (!(m->idata = calloc(m->mstats.nimplibs,sizeof(*m->idata))))
+ if (!(m->m_idata = calloc(m->m_stats.nimplibs,sizeof(*m->m_idata))))
return pe_free_image_meta_impl(
m,PERK_SYSTEM_ERROR(dctx));
- for (i=0; i<m->mstats.nimplibs; i++) {
- pe_read_import_header(&m->aidata[i],&m->idata[i]);
+ for (i=0; i<m->m_stats.nimplibs; i++) {
+ pe_read_import_header(&m->aidata[i],&m->m_idata[i]);
- m->idata[i].ih_name = base + m->hidata->sh_ptr_to_raw_data
- + m->idata[i].ih_name_rva
+ m->m_idata[i].ih_name = base + m->hidata->sh_ptr_to_raw_data
+ + m->m_idata[i].ih_name_rva
- m->hidata->sh_virtual_addr;
- if (m->idata[i].ih_import_lookup_tbl_rva)
- m->idata[i].ih_aitems = (union pe_raw_import_lookup *)(base + m->hidata->sh_ptr_to_raw_data
- + m->idata[i].ih_import_lookup_tbl_rva
+ if (m->m_idata[i].ih_import_lookup_tbl_rva)
+ m->m_idata[i].ih_aitems = (union pe_raw_import_lookup *)(base + m->hidata->sh_ptr_to_raw_data
+ + m->m_idata[i].ih_import_lookup_tbl_rva
- m->hidata->sh_virtual_addr);
/* items */
uint32_t * hint;
- m->idata[i].ih_count = 0;
+ m->m_idata[i].ih_count = 0;
- if (m->idata[i].ih_import_lookup_tbl_rva) {
- pitem = m->idata[i].ih_aitems;
+ if (m->m_idata[i].ih_import_lookup_tbl_rva) {
+ pitem = m->m_idata[i].ih_aitems;
hint = (uint32_t *)pitem->ii_hint_name_tbl_rva;
for (; *hint; hint=(uint32_t *)((++pitem)->ii_hint_name_tbl_rva))
- m->idata[i].ih_count++;
+ m->m_idata[i].ih_count++;
- if (!(m->idata[i].ih_items = calloc(m->idata[i].ih_count,sizeof(*(m->idata[i].ih_items)))))
+ if (!(m->m_idata[i].ih_items = calloc(m->m_idata[i].ih_count,sizeof(*(m->m_idata[i].ih_items)))))
return pe_free_image_meta_impl(
m,PERK_SYSTEM_ERROR(dctx));
}
- for (j=0; j<m->idata[i].ih_count; j++) {
+ for (j=0; j<m->m_idata[i].ih_count; j++) {
if ((ret = pe_read_import_lookup(
- &(m->idata[i].ih_aitems[j]),
- &(m->idata[i].ih_items[j]),
- m->opt.oh_std.coh_magic)))
+ &(m->m_idata[i].ih_aitems[j]),
+ &(m->m_idata[i].ih_items[j]),
+ m->m_opt.oh_std.coh_magic)))
return pe_free_image_meta_impl(
m,PERK_CUSTOM_ERROR(dctx,ret));
- switch (m->opt.oh_std.coh_magic) {
+ switch (m->m_opt.oh_std.coh_magic) {
case PE_MAGIC_PE32:
- m->idata[i].ih_items[j].ii_flags = m->idata[i].ih_items[j].u.ii_import_lookup_entry_32;
+ m->m_idata[i].ih_items[j].ii_flags = m->m_idata[i].ih_items[j].u.ii_import_lookup_entry_32;
break;
case PE_MAGIC_PE32_PLUS:
- m->idata[i].ih_items[j].ii_flags = (m->idata[i].ih_items[j].u.ii_import_lookup_entry_64 >> 32);
+ m->m_idata[i].ih_items[j].ii_flags = (m->m_idata[i].ih_items[j].u.ii_import_lookup_entry_64 >> 32);
break;
}
- if (!m->idata[i].ih_items[j].ii_flags) {
+ if (!m->m_idata[i].ih_items[j].ii_flags) {
struct pe_raw_hint_name_entry * pentry =
(struct pe_raw_hint_name_entry *)(base + m->hidata->sh_ptr_to_raw_data
- + m->idata[i].ih_items[j].u.ii_hint_name_tbl_rva - m->hidata->sh_virtual_addr);
+ + m->m_idata[i].ih_items[j].u.ii_hint_name_tbl_rva - m->hidata->sh_virtual_addr);
- m->idata[i].ih_items[j].ii_name = (char *)pentry->ii_name;
+ m->m_idata[i].ih_items[j].ii_name = (char *)pentry->ii_name;
}
}
}
diff --git a/src/output/pe_output_export_symbols.c b/src/output/pe_output_export_symbols.c
index 697d358..46ed9f9 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.eh_name_ptr_rva - offset);
+ symrva = (uint32_t *)(mark + m->m_edata.eh_name_ptr_rva - offset);
- for (i=0; i<m->edata.eh_num_of_name_ptrs; i++)
+ for (i=0; i<m->m_edata.eh_num_of_name_ptrs; i++)
if ((pretty_export_item(
cctx,
&mark[symrva[i] - offset],
diff --git a/src/output/pe_output_image_sections.c b/src/output/pe_output_image_sections.c
index 0102844..461cf5c 100644
--- a/src/output/pe_output_image_sections.c
+++ b/src/output/pe_output_image_sections.c
@@ -28,12 +28,12 @@ int pe_output_image_sections(
dash = "- ";
}
- for (i=0; i<meta->coff.cfh_num_of_sections; i++)
+ for (i=0; i<meta->m_coff.cfh_num_of_sections; i++)
if (fprintf(fout,"%s%s\n",
dash,
- meta->sectbl[i].sh_long_name
- ? meta->sectbl[i].sh_long_name
- : meta->sectbl[i].sh_name) < 0)
+ meta->m_sectbl[i].sh_long_name
+ ? meta->m_sectbl[i].sh_long_name
+ : meta->m_sectbl[i].sh_name) < 0)
return PERK_FILE_ERROR(dctx);
return 0;
diff --git a/src/output/pe_output_image_strings.c b/src/output/pe_output_image_strings.c
index 549348d..5ffbf93 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.cfh_ptr_to_str_tbl;
+ mark += meta->m_coff.cfh_ptr_to_str_tbl;
- cap = mark + meta->coff.cfh_size_of_str_tbl;
+ cap = mark + meta->m_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 3e828c7..7f16d79 100644
--- a/src/output/pe_output_image_symbols.c
+++ b/src/output/pe_output_image_symbols.c
@@ -34,12 +34,12 @@ int pe_output_image_symbols(
}
mark = (char *)meta->image.addr;
- symtbl = (struct pe_raw_coff_symbol *)(mark + meta->coff.cfh_ptr_to_sym_tbl);
+ symtbl = (struct pe_raw_coff_symbol *)(mark + meta->m_coff.cfh_ptr_to_sym_tbl);
- for (i=0; i<meta->coff.cfh_num_of_syms; i++) {
+ for (i=0; i<meta->m_coff.cfh_num_of_syms; i++) {
pe_read_coff_symbol(
&symtbl[i],&symrec,
- &meta->coff,meta->image.addr);
+ &meta->m_coff,meta->image.addr);
if (fprintf(fout,"%s%s\n",
dash,
diff --git a/src/output/pe_output_import_libraries.c b/src/output/pe_output_import_libraries.c
index 4c317ff..745ab5b 100644
--- a/src/output/pe_output_import_libraries.c
+++ b/src/output/pe_output_import_libraries.c
@@ -50,7 +50,7 @@ int pe_output_import_libraries(
unsigned j;
const struct pe_common_ctx * cctx = dctx->cctx;
- if (!m->mstats.nimplibs)
+ if (!m->m_stats.nimplibs)
return 0;
if (!fout)
@@ -59,16 +59,16 @@ int pe_output_import_libraries(
if ((pretty_header(cctx,fout)) < 0)
return PERK_FILE_ERROR(dctx);
- for (i=0; i<m->mstats.nimplibs; i++) {
- if ((pretty_implib_header(cctx,m->idata[i].ih_name,fout)) < 0)
+ for (i=0; i<m->m_stats.nimplibs; i++) {
+ if ((pretty_implib_header(cctx,m->m_idata[i].ih_name,fout)) < 0)
return PERK_FILE_ERROR(dctx);
if (cctx->fmtflags & PERK_OUTPUT_IMPORT_SYMS)
- for (j=0; j<m->idata[i].ih_count; j++)
- if (m->idata[i].ih_items[j].ii_name)
+ for (j=0; j<m->m_idata[i].ih_count; j++)
+ if (m->m_idata[i].ih_items[j].ii_name)
if ((pretty_implib_item(
cctx,
- m->idata[i].ih_items[j].ii_name,
+ m->m_idata[i].ih_items[j].ii_name,
fout)) < 0)
return PERK_FILE_ERROR(dctx);
}