From 0c1d8308d9ed0eb768298f9e889e8a1f1323242d Mon Sep 17 00:00:00 2001 From: midipix Date: Fri, 2 Dec 2016 17:03:27 -0500 Subject: struct pe_{raw|meta}_coff_symbol: member name normalization. --- src/output/pe_output_image_symbols.c | 8 ++++---- src/reader/pe_read_coff_symbol.c | 40 ++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src') 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; -- cgit v1.2.3