summaryrefslogtreecommitdiff
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-11-02 21:39:26 -0500
committermidipix <writeonce@midipix.org>2018-11-20 20:25:14 -0500
commitaec459048d46959149a4ca11756fc11992c3ca7f (patch)
tree4daaaa304374ac857e33c339cd1f3a8a6e878a98 /src/logic
parent1808909e9661994eee2471126c15d9e2365ad117 (diff)
downloadperk-aec459048d46959149a4ca11756fc11992c3ca7f.tar.bz2
perk-aec459048d46959149a4ca11756fc11992c3ca7f.tar.xz
pe_get_image_meta(), pe_get_image_subtype(): init/use the .m_subtype member.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/pe_get_image_meta.c17
1 files changed, 17 insertions, 0 deletions
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)