summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-02 17:03:27 -0500
committermidipix <writeonce@midipix.org>2016-12-02 17:16:29 -0500
commit0c1d8308d9ed0eb768298f9e889e8a1f1323242d (patch)
tree4929826b3f7310097ba4c26a1eea1d029a0ad22c
parentc8c13111b25d5953956742de4c54e5856737df13 (diff)
downloadperk-0c1d8308d9ed0eb768298f9e889e8a1f1323242d.tar.bz2
perk-0c1d8308d9ed0eb768298f9e889e8a1f1323242d.tar.xz
struct pe_{raw|meta}_coff_symbol: member name normalization.
-rw-r--r--include/perk/perk_meta.h14
-rw-r--r--include/perk/perk_structs.h12
-rw-r--r--src/output/pe_output_image_symbols.c8
-rw-r--r--src/reader/pe_read_coff_symbol.c40
4 files changed, 37 insertions, 37 deletions
diff --git a/include/perk/perk_meta.h b/include/perk/perk_meta.h
index b743196..a267a04 100644
--- a/include/perk/perk_meta.h
+++ b/include/perk/perk_meta.h
@@ -250,13 +250,13 @@ struct pe_meta_import_hdr {
/* coff: symbol table entry */
struct pe_meta_coff_symbol {
- char name[24];
- char * long_name;
- uint32_t value;
- int16_t section_number;
- uint16_t type;
- unsigned char storage_class;
- unsigned char num_of_aux_symbols;
+ char cs_name[24];
+ char * cs_long_name;
+ uint32_t cs_value;
+ int16_t cs_section_number;
+ uint16_t cs_type;
+ unsigned char cs_storage_class;
+ unsigned char cs_num_of_aux_symbols;
};
diff --git a/include/perk/perk_structs.h b/include/perk/perk_structs.h
index 06ff7ec..11c651f 100644
--- a/include/perk/perk_structs.h
+++ b/include/perk/perk_structs.h
@@ -288,12 +288,12 @@ struct pe_raw_hint_name_entry {
struct pe_raw_coff_symbol {
- unsigned char name [0x08]; /* 0x00 */
- unsigned char value [0x04]; /* 0x08 */
- unsigned char section_number [0x02]; /* 0x0c */
- unsigned char type [0x02]; /* 0x0e */
- unsigned char storage_class [0x01]; /* 0x10 */
- unsigned char num_of_aux_symbols [0x01]; /* 0x11 */
+ unsigned char cs_name [0x08]; /* 0x00 */
+ unsigned char cs_value [0x04]; /* 0x08 */
+ unsigned char cs_section_number [0x02]; /* 0x0c */
+ unsigned char cs_type [0x02]; /* 0x0e */
+ unsigned char cs_storage_class [0x01]; /* 0x10 */
+ unsigned char cs_num_of_aux_symbols [0x01]; /* 0x11 */
};
struct pe_raw_coff_symbol_name {
diff --git a/src/output/pe_output_image_symbols.c b/src/output/pe_output_image_symbols.c
index 7282436..8243d6e 100644
--- a/src/output/pe_output_image_symbols.c
+++ b/src/output/pe_output_image_symbols.c
@@ -43,12 +43,12 @@ int pe_output_image_symbols(
if (fprintf(fout,"%s%s\n",
dash,
- symrec.long_name
- ? symrec.long_name
- : symrec.name) < 0)
+ symrec.cs_long_name
+ ? symrec.cs_long_name
+ : symrec.cs_name) < 0)
return PERK_FILE_ERROR(dctx);
- i += symtbl[i].num_of_aux_symbols[0];
+ i += symtbl[i].cs_num_of_aux_symbols[0];
}
return 0;
diff --git a/src/reader/pe_read_coff_symbol.c b/src/reader/pe_read_coff_symbol.c
index 0c6a40d..b7bb767 100644
--- a/src/reader/pe_read_coff_symbol.c
+++ b/src/reader/pe_read_coff_symbol.c
@@ -20,35 +20,35 @@ int pe_read_coff_symbol(
char * mark;
unsigned bias = 0;
- m->long_name = 0;
- m->value = pe_read_long(p->value);
- m->section_number = pe_read_short(p->section_number);
- m->type = pe_read_short(p->type);
- m->storage_class = p->storage_class[0];
- m->num_of_aux_symbols = p->num_of_aux_symbols[0];
-
- memset(m->name,0,sizeof(m->name));
-
- if (p->storage_class[0] == PE_IMAGE_SYM_CLASS_FILE)
- if (p->num_of_aux_symbols[0])
- if (!p[1].value[0])
+ m->cs_long_name = 0;
+ m->cs_value = pe_read_long(p->cs_value);
+ m->cs_section_number = pe_read_short(p->cs_section_number);
+ m->cs_type = pe_read_short(p->cs_type);
+ m->cs_storage_class = p->cs_storage_class[0];
+ m->cs_num_of_aux_symbols = p->cs_num_of_aux_symbols[0];
+
+ memset(m->cs_name,0,sizeof(m->cs_name));
+
+ if (p->cs_storage_class[0] == PE_IMAGE_SYM_CLASS_FILE)
+ if (p->cs_num_of_aux_symbols[0])
+ if (!p[1].cs_value[0])
bias = 1;
p += bias;
- if (!bias && (p->storage_class[0] == PE_IMAGE_SYM_CLASS_FILE)
- && p->num_of_aux_symbols[0]) {
- memcpy(m->name,p[1].name,sizeof(*p));
+ if (!bias && (p->cs_storage_class[0] == PE_IMAGE_SYM_CLASS_FILE)
+ && p->cs_num_of_aux_symbols[0]) {
+ memcpy(m->cs_name,p[1].cs_name,sizeof(*p));
- } else if (p->name[0]) {
- memcpy(m->name,p->name,sizeof(p->name));
+ } else if (p->cs_name[0]) {
+ memcpy(m->cs_name,p->cs_name,sizeof(p->cs_name));
- } else if (!p->name[1] && !p->name[2] && !p->name[3]) {
+ } else if (!p->cs_name[1] && !p->cs_name[2] && !p->cs_name[3]) {
mark = (char *)base;
- roffset = pe_read_long(&p->name[4]);
+ roffset = pe_read_long(&p->cs_name[4]);
if (roffset < coff->cfh_size_of_str_tbl)
- m->long_name = mark + coff->cfh_ptr_to_str_tbl + roffset;
+ m->cs_long_name = mark + coff->cfh_ptr_to_str_tbl + roffset;
}
return 0;