diff options
-rw-r--r-- | src/info/pe_get_image_subtype.c | 10 | ||||
-rw-r--r-- | src/logic/pe_get_image_meta.c | 17 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/info/pe_get_image_subtype.c b/src/info/pe_get_image_subtype.c index 69b6569..94fd081 100644 --- a/src/info/pe_get_image_subtype.c +++ b/src/info/pe_get_image_subtype.c @@ -22,14 +22,8 @@ int pe_get_image_subtype(const struct pe_image_meta * m, struct pe_info_string * { int subtype; - if (m->r_obj) - subtype = PE_SUBTYPE_OBJ; - - else if (m->m_coff.cfh_characteristics & PE_IMAGE_FILE_DLL) - subtype = PE_SUBTYPE_DLL; - - else - subtype = PE_SUBTYPE_EXE; + if (((subtype = m->m_subtype) < 0) || (subtype >= PE_SUBTYPE_CAP)) + subtype = PE_SUBTYPE_UNRECOGNIZED; if (infostr) strcpy(infostr->buffer,pe_subtype_str[subtype]); diff --git a/src/logic/pe_get_image_meta.c b/src/logic/pe_get_image_meta.c index 826b36b..d47b922 100644 --- a/src/logic/pe_get_image_meta.c +++ b/src/logic/pe_get_image_meta.c @@ -209,6 +209,22 @@ static void pe_detect_image_abi(struct pe_image_meta * m) m->m_abi = abi; } +static void pe_detect_image_subtype(struct pe_image_meta * m) +{ + int subtype; + + if (m->r_obj) + subtype = PE_SUBTYPE_OBJ; + + else if (m->m_coff.cfh_characteristics & PE_IMAGE_FILE_DLL) + subtype = PE_SUBTYPE_DLL; + + else + subtype = PE_SUBTYPE_EXE; + + m->m_subtype = subtype; +} + int pe_get_image_meta( const struct pe_driver_ctx * dctx, const struct pe_raw_image * image, @@ -428,6 +444,7 @@ int pe_get_image_meta( /* info */ pe_detect_image_abi(m); + pe_detect_image_subtype(m); /* mdso abi */ if (m->h_dsometa || m->h_dsosyms) |