diff options
author | midipix <writeonce@midipix.org> | 2021-04-09 07:03:37 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2021-04-09 07:11:47 +0000 |
commit | a9d23f9a72373e0bd8ce580d043aa19140855ec3 (patch) | |
tree | 5da9b6283df92f34c06411435f0385c7b2bebace | |
parent | d38fc0c36bc9530fdebf709316a73ad6db5e2db5 (diff) | |
download | perk-a9d23f9a72373e0bd8ce580d043aa19140855ec3.tar.bz2 perk-a9d23f9a72373e0bd8ce580d043aa19140855ec3.tar.xz |
utility: pe_perform_hdrdump_actions(): initial implementation.
-rw-r--r-- | src/driver/pe_amain.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/driver/pe_amain.c b/src/driver/pe_amain.c index 50d18ac..00f5ed3 100644 --- a/src/driver/pe_amain.c +++ b/src/driver/pe_amain.c @@ -48,6 +48,32 @@ static ssize_t pe_version(struct pe_driver_ctx * dctx, int fdout) verclr[4],verinfo->commit,verclr[5]); } +static void pe_perform_hdrdump_actions( + const struct pe_driver_ctx * dctx, + struct pe_unit_ctx * uctx) +{ + if (dctx->cctx->hdrdump & PERK_HDRDUMP_IMAGE_DOS_HEADER) + pe_hdrdump_image_dos_hdr(dctx,uctx->meta); + + if (dctx->cctx->hdrdump & PERK_HDRDUMP_COFF_IMAGE_HEADER) + pe_hdrdump_coff_image_hdr(dctx,uctx->meta); + + if (dctx->cctx->hdrdump & PERK_HDRDUMP_COFF_OBJECT_HEADER) + pe_hdrdump_coff_object_hdr(dctx,uctx->meta); + + if (dctx->cctx->hdrdump & PERK_HDRDUMP_COFF_OPT_HEADER) + pe_hdrdump_opt_hdr(dctx,uctx->meta); + + if (dctx->cctx->hdrdump & PERK_HDRDUMP_SECTION_TABLE) + pe_hdrdump_sec_tbl(dctx,uctx->meta); + + if (dctx->cctx->hdrdump & PERK_HDRDUMP_EXPORT_HEADER) + pe_hdrdump_export_hdr(dctx,uctx->meta); + + if (dctx->cctx->hdrdump & PERK_HDRDUMP_IMPORT_TABLE) + pe_hdrdump_import_tbl(dctx,uctx->meta); +} + static void pe_perform_unit_actions( const struct pe_driver_ctx * dctx, struct pe_unit_ctx * uctx) @@ -74,6 +100,9 @@ static void pe_perform_unit_actions( if ((flags & PERK_OUTPUT_MDSO_LIBS) || (flags & PERK_OUTPUT_MDSO_SYMS)) pe_output_mdso_libraries(dctx,uctx->meta); + + if (dctx->cctx->hdrdump) + pe_perform_hdrdump_actions(dctx,uctx); } static int pe_exit(struct pe_driver_ctx * dctx, int ret) |