summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/output/pe_output_image_type.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/src/output/pe_output_image_type.c b/src/output/pe_output_image_type.c
index 0e3ce56..b6324a5 100644
--- a/src/output/pe_output_image_type.c
+++ b/src/output/pe_output_image_type.c
@@ -15,19 +15,6 @@
#include <perk/perk_output.h>
#include "perk_errinfo_impl.h"
-static const char const * pe_subsystem_name[0x10] = {
- [PE_IMAGE_SUBSYSTEM_UNKNOWN] = "unknown",
- [PE_IMAGE_SUBSYSTEM_NATIVE] = "native",
- [PE_IMAGE_SUBSYSTEM_WINDOWS_GUI] = "windows",
- [PE_IMAGE_SUBSYSTEM_WINDOWS_CUI] = "console",
- [PE_IMAGE_SUBSYSTEM_POSIX_CUI] = "posix",
- [PE_IMAGE_SUBSYSTEM_WINDOWS_CE_GUI] = "wince",
- [PE_IMAGE_SUBSYSTEM_EFI_APPLICATION] = "efi_app",
- [PE_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER] = "efi_driver",
- [PE_IMAGE_SUBSYSTEM_EFI_ROM] = "efi_rom",
- [PE_IMAGE_SUBSYSTEM_XBOX] = "xbox"
-};
-
static const char * pretty_abi(const struct pe_unit_ctx * uctx)
{
switch (uctx->meta->opt.std.magic) {
@@ -50,29 +37,19 @@ static const char * pretty_type(const struct pe_unit_ctx * uctx)
return "exe";
}
-static const char * pretty_subsystem(const struct pe_unit_ctx * uctx)
-{
- if (uctx->meta->opt.img.subsystem >= 0x10)
- return "UNEXPECTED_SUBSYSTEM";
-
- else if (!pe_subsystem_name[uctx->meta->opt.img.subsystem])
- return "UNEXPECTED_SUBSYSTEM";
-
- else
- return pe_subsystem_name[uctx->meta->opt.img.subsystem];
-}
-
int pe_output_image_type(
const struct pe_driver_ctx * dctx,
const struct pe_unit_ctx * uctx,
FILE * fout)
{
+ 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_subsystem(meta,&subsystem);
pe_get_image_framework(meta,&framework);
if (dctx->cctx->fmtflags & PERK_PRETTY_YAML) {
@@ -80,14 +57,14 @@ int pe_output_image_type(
*uctx->path,
pretty_abi(uctx),
pretty_type(uctx),
- pretty_subsystem(uctx),
+ subsystem.buffer,
framework.buffer) < 0)
return PERK_FILE_ERROR(dctx);
} else {
if (fprintf(fout,"%s-%s-%s-%s\n",
pretty_abi(uctx),
pretty_type(uctx),
- pretty_subsystem(uctx),
+ subsystem.buffer,
framework.buffer) < 0)
return PERK_FILE_ERROR(dctx);
}