From 665ac36fa8328a852876551140cd9fc6c4c22b94 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 12 Nov 2016 16:20:21 -0500 Subject: driver: added --type support (print image type). --- include/perk/perk.h | 1 + include/perk/perk_output.h | 1 + src/driver/pe_driver_ctx.c | 4 ++++ src/internal/perk_driver_impl.h | 1 + src/skin/pe_skin_default.c | 4 ++++ 5 files changed, 11 insertions(+) diff --git a/include/perk/perk.h b/include/perk/perk.h index 8624838..5e6010d 100644 --- a/include/perk/perk.h +++ b/include/perk/perk.h @@ -194,6 +194,7 @@ perk_api void pe_free_unit_ctx (struct pe_unit_ctx *); /* utility api */ perk_api int pe_main (int, char **, char **); +perk_api int pe_output_image_type (const struct pe_driver_ctx *, const struct pe_unit_ctx *, FILE *); perk_api int pe_output_export_symbols (const struct pe_driver_ctx *, const struct pe_image_meta *, FILE *); perk_api int pe_output_import_libraries(const struct pe_driver_ctx *, const struct pe_image_meta *, FILE *); perk_api int pe_output_error_record (const struct pe_driver_ctx *, const struct pe_error_info *); diff --git a/include/perk/perk_output.h b/include/perk/perk_output.h index 0d03181..b5ad5c5 100644 --- a/include/perk/perk_output.h +++ b/include/perk/perk_output.h @@ -9,6 +9,7 @@ #define PERK_OUTPUT_EXPORT_SYMS 0x00000001 #define PERK_OUTPUT_IMPORT_LIBS 0x00000002 #define PERK_OUTPUT_IMPORT_SYMS 0x00000004 +#define PERK_OUTPUT_IMAGE_TYPE 0x00000008 /* pretty-printer flags */ diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c index fdc2704..942291b 100644 --- a/src/driver/pe_driver_ctx.c +++ b/src/driver/pe_driver_ctx.c @@ -165,6 +165,10 @@ int pe_get_driver_ctx( pretty = entry->arg; break; + case TAG_IMGTYPE: + cctx.fmtflags |= PERK_OUTPUT_IMAGE_TYPE; + break; + case TAG_EXPSYMS: cctx.fmtflags |= PERK_OUTPUT_EXPORT_SYMS; break; diff --git a/src/internal/perk_driver_impl.h b/src/internal/perk_driver_impl.h index ae5adfc..78d55ae 100644 --- a/src/internal/perk_driver_impl.h +++ b/src/internal/perk_driver_impl.h @@ -16,6 +16,7 @@ enum app_tags { TAG_VERSION, TAG_OUTPUT, TAG_PRETTY, + TAG_IMGTYPE, TAG_EXPSYMS, TAG_IMPLIBS, TAG_IMPSYMS, diff --git a/src/skin/pe_skin_default.c b/src/skin/pe_skin_default.c index ad663e8..56fbd14 100644 --- a/src/skin/pe_skin_default.c +++ b/src/skin/pe_skin_default.c @@ -14,6 +14,9 @@ const struct argv_option pe_default_options[] = { {"pretty", 'p',TAG_PRETTY,ARGV_OPTARG_REQUIRED,0,"yaml|dlltool",0, "format output for parsing by %s"}, + {"type", 't',TAG_IMGTYPE,ARGV_OPTARG_NONE,0,0,0, + "print image type"}, + {"expsyms", 'e',TAG_EXPSYMS,ARGV_OPTARG_NONE,0,0,0, "print exported symbols" }, @@ -23,5 +26,6 @@ const struct argv_option pe_default_options[] = { {"impsyms", 'I',TAG_IMPSYMS,ARGV_OPTARG_NONE,0,0,0, "list direct dependency libraries " "along with required symbols"}, + {0,0,0,0,0,0,0,0} }; -- cgit v1.2.3