From cd4ace49776d042189f1066a357d1ca2d9f81332 Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 15 Nov 2016 09:37:28 -0500 Subject: output: renamed pe_output_image_type() --> pe_output_image_category(). --- include/perk/perk.h | 2 +- include/perk/perk_output.h | 2 +- project/common.mk | 2 +- src/driver/pe_amain.c | 4 +-- src/driver/pe_driver_ctx.c | 4 +-- src/internal/perk_driver_impl.h | 2 +- src/output/pe_output_image_category.c | 50 +++++++++++++++++++++++++++++++++++ src/output/pe_output_image_type.c | 50 ----------------------------------- src/skin/pe_skin_default.c | 2 +- 9 files changed, 59 insertions(+), 59 deletions(-) create mode 100644 src/output/pe_output_image_category.c delete mode 100644 src/output/pe_output_image_type.c diff --git a/include/perk/perk.h b/include/perk/perk.h index 88aed0b..b24be37 100644 --- a/include/perk/perk.h +++ b/include/perk/perk.h @@ -170,7 +170,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_image_category (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 ab91f87..6ef9054 100644 --- a/include/perk/perk_output.h +++ b/include/perk/perk_output.h @@ -9,7 +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 +#define PERK_OUTPUT_IMAGE_CATEGORY 0x00000008 #define PERK_OUTPUT_IMAGE_SECTIONS 0x00000010 diff --git a/project/common.mk b/project/common.mk index 70041dd..f7eb597 100644 --- a/project/common.mk +++ b/project/common.mk @@ -10,7 +10,7 @@ API_SRCS = \ src/logic/pe_map_raw_image.c \ src/output/pe_output_error.c \ src/output/pe_output_export_symbols.c \ - src/output/pe_output_image_type.c \ + src/output/pe_output_image_category.c \ src/output/pe_output_import_libraries.c \ src/reader/pe_read_coff_header.c \ src/reader/pe_read_dos_header.c \ diff --git a/src/driver/pe_amain.c b/src/driver/pe_amain.c index d23e9fe..3096561 100644 --- a/src/driver/pe_amain.c +++ b/src/driver/pe_amain.c @@ -62,8 +62,8 @@ static void pe_perform_unit_actions( int fpara = 0; uint64_t flags = dctx->cctx->fmtflags; - if (flags & PERK_OUTPUT_IMAGE_TYPE) - pe_output_image_type(dctx,uctx,0); + if (flags & PERK_OUTPUT_IMAGE_CATEGORY) + pe_output_image_category(dctx,uctx,0); if (flags & PERK_OUTPUT_EXPORT_SYMS) { pe_output_export_symbols(dctx,uctx->meta,0); diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c index 8ca3ba6..32faa7d 100644 --- a/src/driver/pe_driver_ctx.c +++ b/src/driver/pe_driver_ctx.c @@ -160,8 +160,8 @@ int pe_get_driver_ctx( pretty = entry->arg; break; - case TAG_IMGTYPE: - cctx.fmtflags |= PERK_OUTPUT_IMAGE_TYPE; + case TAG_CATEGORY: + cctx.fmtflags |= PERK_OUTPUT_IMAGE_CATEGORY; break; case TAG_SECTIONS: diff --git a/src/internal/perk_driver_impl.h b/src/internal/perk_driver_impl.h index 5ca0bc3..f52e328 100644 --- a/src/internal/perk_driver_impl.h +++ b/src/internal/perk_driver_impl.h @@ -16,7 +16,7 @@ enum app_tags { TAG_VERSION, TAG_OUTPUT, TAG_PRETTY, - TAG_IMGTYPE, + TAG_CATEGORY, TAG_SECTIONS, TAG_EXPSYMS, TAG_IMPLIBS, diff --git a/src/output/pe_output_image_category.c b/src/output/pe_output_image_category.c new file mode 100644 index 0000000..2550267 --- /dev/null +++ b/src/output/pe_output_image_category.c @@ -0,0 +1,50 @@ +/***************************************************************/ +/* perk: PE Resource Kit */ +/* Copyright (C) 2015--2016 Z. Gilboa */ +/* Released under GPLv2 and GPLv3; see COPYING.PERK. */ +/***************************************************************/ + +#include + +#include +#include +#include "perk_errinfo_impl.h" + +int pe_output_image_category( + const struct pe_driver_ctx * dctx, + const struct pe_unit_ctx * uctx, + FILE * fout) +{ + struct pe_info_string abi; + struct pe_info_string subtype; + struct pe_info_string subsystem; + struct pe_info_string framework; + const struct pe_image_meta * meta = uctx->meta; + + if (!fout) + fout = stdout; + + pe_get_image_abi (meta,&abi); + pe_get_image_subtype (meta,&subtype); + pe_get_image_subsystem(meta,&subsystem); + pe_get_image_framework(meta,&framework); + + if (dctx->cctx->fmtflags & PERK_PRETTY_YAML) { + if (fprintf(fout,"%s:\n- %s:\n- %s:\n- %s:\n- %s:\n", + *uctx->path, + abi.buffer, + subtype.buffer, + subsystem.buffer, + framework.buffer) < 0) + return PERK_FILE_ERROR(dctx); + } else { + if (fprintf(fout,"%s-%s-%s-%s\n", + abi.buffer, + subtype.buffer, + subsystem.buffer, + framework.buffer) < 0) + return PERK_FILE_ERROR(dctx); + } + + return 0; +} diff --git a/src/output/pe_output_image_type.c b/src/output/pe_output_image_type.c deleted file mode 100644 index 3df5316..0000000 --- a/src/output/pe_output_image_type.c +++ /dev/null @@ -1,50 +0,0 @@ -/***************************************************************/ -/* perk: PE Resource Kit */ -/* Copyright (C) 2015--2016 Z. Gilboa */ -/* Released under GPLv2 and GPLv3; see COPYING.PERK. */ -/***************************************************************/ - -#include - -#include -#include -#include "perk_errinfo_impl.h" - -int pe_output_image_type( - const struct pe_driver_ctx * dctx, - const struct pe_unit_ctx * uctx, - FILE * fout) -{ - struct pe_info_string abi; - struct pe_info_string subtype; - struct pe_info_string subsystem; - struct pe_info_string framework; - const struct pe_image_meta * meta = uctx->meta; - - if (!fout) - fout = stdout; - - pe_get_image_abi (meta,&abi); - pe_get_image_subtype (meta,&subtype); - pe_get_image_subsystem(meta,&subsystem); - pe_get_image_framework(meta,&framework); - - if (dctx->cctx->fmtflags & PERK_PRETTY_YAML) { - if (fprintf(fout,"%s:\n- %s:\n- %s:\n- %s:\n- %s:\n", - *uctx->path, - abi.buffer, - subtype.buffer, - subsystem.buffer, - framework.buffer) < 0) - return PERK_FILE_ERROR(dctx); - } else { - if (fprintf(fout,"%s-%s-%s-%s\n", - abi.buffer, - subtype.buffer, - subsystem.buffer, - framework.buffer) < 0) - return PERK_FILE_ERROR(dctx); - } - - return 0; -} diff --git a/src/skin/pe_skin_default.c b/src/skin/pe_skin_default.c index 8bf40e1..baafc8a 100644 --- a/src/skin/pe_skin_default.c +++ b/src/skin/pe_skin_default.c @@ -14,7 +14,7 @@ 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, + {"category", 'c',TAG_CATEGORY,ARGV_OPTARG_NONE,0,0,0, "print image type"}, {"sections", 's',TAG_SECTIONS,ARGV_OPTARG_NONE,0,0,0, -- cgit v1.2.3