summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2021-04-09 07:01:53 +0000
committermidipix <writeonce@midipix.org>2021-04-09 07:11:47 +0000
commitd38fc0c36bc9530fdebf709316a73ad6db5e2db5 (patch)
treefc1fde9790611237ec46a7a4c9e70b35a7667d2d /src/driver
parent44ba87393046804e3661da9cf9c8e639b82c5cf0 (diff)
downloadperk-d38fc0c36bc9530fdebf709316a73ad6db5e2db5.tar.bz2
perk-d38fc0c36bc9530fdebf709316a73ad6db5e2db5.tar.xz
driver: added --hdrdump support.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/pe_driver_ctx.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c
index 486284c..bc20b6d 100644
--- a/src/driver/pe_driver_ctx.c
+++ b/src/driver/pe_driver_ctx.c
@@ -215,6 +215,43 @@ int pe_get_driver_ctx(
case TAG_DSOSYMS:
cctx.fmtflags |= PERK_OUTPUT_MDSO_SYMS;
break;
+
+ case TAG_HDRDUMP:
+ if (!entry->arg) {
+ cctx.hdrdump = 0;
+ cctx.hdrdump = ~cctx.hdrdump;
+ } else if (!strcmp(entry->arg,"dos")) {
+ cctx.hdrdump = PERK_HDRDUMP_IMAGE_DOS_HEADER;
+ } else if (!strcmp(entry->arg,"image.dos")) {
+ cctx.hdrdump = PERK_HDRDUMP_IMAGE_DOS_HEADER;
+ } else if (!strcmp(entry->arg,"coff")) {
+ cctx.hdrdump = PERK_HDRDUMP_COFF_IMAGE_HEADER;
+ cctx.hdrdump |= PERK_HDRDUMP_COFF_OBJECT_HEADER;
+ cctx.hdrdump |= PERK_HDRDUMP_COFF_OPT_HEADER;
+ } else if (!strcmp(entry->arg,"coff.image")) {
+ cctx.hdrdump = PERK_HDRDUMP_COFF_IMAGE_HEADER;
+ } else if (!strcmp(entry->arg,"coff.obj")) {
+ cctx.hdrdump = PERK_HDRDUMP_COFF_OBJECT_HEADER;
+ } else if (!strcmp(entry->arg,"coff.object")) {
+ cctx.hdrdump = PERK_HDRDUMP_COFF_OBJECT_HEADER;
+ } else if (!strcmp(entry->arg,"coff.opt")) {
+ cctx.hdrdump = PERK_HDRDUMP_COFF_OPT_HEADER;
+ } else if (!strcmp(entry->arg,"coff.optional")) {
+ cctx.hdrdump = PERK_HDRDUMP_COFF_OPT_HEADER;
+ } else if (!strcmp(entry->arg,"sectbl")) {
+ cctx.hdrdump = PERK_HDRDUMP_SECTION_TABLE;
+ } else if (!strcmp(entry->arg,"section.table")) {
+ cctx.hdrdump = PERK_HDRDUMP_SECTION_TABLE;
+ } else if (!strcmp(entry->arg,"exphdr")) {
+ cctx.hdrdump = PERK_HDRDUMP_EXPORT_HEADER;
+ } else if (!strcmp(entry->arg,"export.header")) {
+ cctx.hdrdump = PERK_HDRDUMP_EXPORT_HEADER;
+ } else if (!strcmp(entry->arg,"imptbl")) {
+ cctx.hdrdump = PERK_HDRDUMP_IMPORT_TABLE;
+ } else if (!strcmp(entry->arg,"import.table")) {
+ cctx.hdrdump = PERK_HDRDUMP_IMPORT_TABLE;
+ }
+ break;
}
} else
nunits++;