|
|
007c7f |
/***************************************************************/
|
|
|
007c7f |
/* perk: PE Resource Kit */
|
|
|
007c7f |
/* Copyright (C) 2015--2016 Z. Gilboa */
|
|
|
007c7f |
/* Released under GPLv2 and GPLv3; see COPYING.PERK. */
|
|
|
007c7f |
/***************************************************************/
|
|
|
007c7f |
|
|
|
007c7f |
#include <stdio.h>
|
|
|
007c7f |
|
|
|
007c7f |
#include <perk/perk.h>
|
|
|
007c7f |
#include <perk/perk_output.h>
|
|
|
007c7f |
#include "perk_errinfo_impl.h"
|
|
|
007c7f |
|
|
|
cd4ace |
int pe_output_image_category(
|
|
|
007c7f |
const struct pe_driver_ctx * dctx,
|
|
|
007c7f |
const struct pe_unit_ctx * uctx,
|
|
|
007c7f |
FILE * fout)
|
|
|
007c7f |
{
|
|
|
50a830 |
struct pe_info_string abi;
|
|
|
919d9d |
struct pe_info_string subtype;
|
|
|
a97030 |
struct pe_info_string subsystem;
|
|
|
58df62 |
struct pe_info_string framework;
|
|
|
58df62 |
const struct pe_image_meta * meta = uctx->meta;
|
|
|
58df62 |
|
|
|
f11c1f |
if (!fout)
|
|
|
f11c1f |
fout = stdout;
|
|
|
007c7f |
|
|
|
50a830 |
pe_get_image_abi (meta,&abi;;
|
|
|
919d9d |
pe_get_image_subtype (meta,&subtype);
|
|
|
a97030 |
pe_get_image_subsystem(meta,&subsystem);
|
|
|
58df62 |
pe_get_image_framework(meta,&framework);
|
|
|
58df62 |
|
|
|
007c7f |
if (dctx->cctx->fmtflags & PERK_PRETTY_YAML) {
|
|
|
007c7f |
if (fprintf(fout,"%s:\n- %s:\n- %s:\n- %s:\n- %s:\n",
|
|
|
007c7f |
*uctx->path,
|
|
|
50a830 |
abi.buffer,
|
|
|
919d9d |
subtype.buffer,
|
|
|
a97030 |
subsystem.buffer,
|
|
|
58df62 |
framework.buffer) < 0)
|
|
|
f11c1f |
return PERK_FILE_ERROR(dctx);
|
|
|
007c7f |
} else {
|
|
|
007c7f |
if (fprintf(fout,"%s-%s-%s-%s\n",
|
|
|
50a830 |
abi.buffer,
|
|
|
919d9d |
subtype.buffer,
|
|
|
a97030 |
subsystem.buffer,
|
|
|
58df62 |
framework.buffer) < 0)
|
|
|
f11c1f |
return PERK_FILE_ERROR(dctx);
|
|
|
007c7f |
}
|
|
|
007c7f |
|
|
|
f11c1f |
return 0;
|
|
|
007c7f |
}
|