From 08a8944a7ecd8faa1fbe09e4bb0abbd3970735a6 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 2 Mar 2016 12:01:40 -0500 Subject: output: implemented --pretty=dlltool for exported symbols. --- include/perk/perk_output.h | 1 + src/driver/pe_driver_ctx.c | 2 ++ src/output/pe_output_export_symbols.c | 8 +++++--- src/skin/pe_skin_default.c | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/perk/perk_output.h b/include/perk/perk_output.h index 91c8aee..0d03181 100644 --- a/include/perk/perk_output.h +++ b/include/perk/perk_output.h @@ -17,5 +17,6 @@ #define PERK_PRETTY_READOBJ PERK_PRETTY(0x00000004) #define PERK_PRETTY_OBJDUMP PERK_PRETTY(0x00000008) #define PERK_PRETTY_YAML PERK_PRETTY(0x00000010) +#define PERK_PRETTY_DLLTOOL PERK_PRETTY(0x00000020) #endif diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c index bf55e5e..6d02c69 100644 --- a/src/driver/pe_driver_ctx.c +++ b/src/driver/pe_driver_ctx.c @@ -169,6 +169,8 @@ int pe_get_driver_ctx( if (pretty && !strcmp(pretty,"yaml")) cctx.fmtflags |= PERK_PRETTY_YAML; + else if (pretty && !strcmp(pretty,"dlltool")) + cctx.fmtflags |= PERK_PRETTY_DLLTOOL; if (!(ctx = pe_driver_ctx_alloc(meta,&cctx,nunits)) && cctx.output) close(fdout); diff --git a/src/output/pe_output_export_symbols.c b/src/output/pe_output_export_symbols.c index 642d539..0ab3539 100644 --- a/src/output/pe_output_export_symbols.c +++ b/src/output/pe_output_export_symbols.c @@ -16,9 +16,11 @@ static int pretty_header(const struct pe_common_ctx * cctx, FILE * fout) { - return (cctx->fmtflags & PERK_PRETTY_YAML) - ? fputs("exports:\n",fout) - : 0; + if (cctx->fmtflags & PERK_PRETTY_YAML) + return fputs("exports:\n",fout); + else if (cctx->fmtflags & PERK_PRETTY_DLLTOOL) + return fputs("EXPORTS\n",fout); + return 0; } static int pretty_export_item(const struct pe_common_ctx * cctx, const char * name, FILE * fout) diff --git a/src/skin/pe_skin_default.c b/src/skin/pe_skin_default.c index c9e374d..21fab05 100644 --- a/src/skin/pe_skin_default.c +++ b/src/skin/pe_skin_default.c @@ -11,7 +11,7 @@ const struct argv_option pe_default_options[] = { {"output", 'o',TAG_OUTPUT,ARGV_OPTARG_REQUIRED,0,0,"", "write output to %s"}, - {"pretty", 'p',TAG_PRETTY,ARGV_OPTARG_REQUIRED,0,"yaml",0, + {"pretty", 'p',TAG_PRETTY,ARGV_OPTARG_REQUIRED,0,"yaml|dlltool",0, "format output for parsing by %s"}, {"expsyms", 'e',TAG_EXPSYMS,ARGV_OPTARG_NONE,0,0,0, -- cgit v1.2.3