summaryrefslogtreecommitdiff
path: root/src/output
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-11-14 21:48:35 -0500
committermidipix <writeonce@midipix.org>2016-11-14 21:48:35 -0500
commit58df628aff5ae52d1e5570287ef3ec3d8c385ae2 (patch)
treeeefad3f6124bcce8c51bb6de6b890c064c3fe4ec /src/output
parentbf447fdc36b3ce0280960d28d736a41f89b5b854 (diff)
downloadperk-58df628aff5ae52d1e5570287ef3ec3d8c385ae2.tar.bz2
perk-58df628aff5ae52d1e5570287ef3ec3d8c385ae2.tar.xz
info api: pe_get_image_framework(): initial integration.
Diffstat (limited to 'src/output')
-rw-r--r--src/output/pe_output_image_type.c82
1 files changed, 7 insertions, 75 deletions
diff --git a/src/output/pe_output_image_type.c b/src/output/pe_output_image_type.c
index 1d0ff59..0e3ce56 100644
--- a/src/output/pe_output_image_type.c
+++ b/src/output/pe_output_image_type.c
@@ -62,101 +62,33 @@ static const char * pretty_subsystem(const struct pe_unit_ctx * uctx)
return pe_subsystem_name[uctx->meta->opt.img.subsystem];
}
-static bool pe_image_is_psxscl(const struct pe_unit_ctx * uctx)
-{
- return (!uctx->meta->summary.nimplibs
- && !pe_get_expsym_by_name(uctx->meta,"__psx_init",0));
-}
-
-static bool pe_image_is_cygwin(const struct pe_unit_ctx * uctx)
-{
- int i;
- const struct pe_image_meta * meta = uctx->meta;
-
- for (i=0; i<uctx->meta->summary.nimplibs; i++)
- if (!(strcmp(meta->idata[i].name,"cygwin1.dll")))
- return true;
-
- return false;
-}
-
-static bool pe_image_is_msys(const struct pe_unit_ctx * uctx)
-{
- int i;
- const struct pe_image_meta * meta = uctx->meta;
-
- for (i=0; i<uctx->meta->summary.nimplibs; i++)
- if (!(strcmp(meta->idata[i].name,"msys-2.0.dll")))
- return true;
-
- return false;
-}
-
-static bool pe_image_is_mingw(const struct pe_unit_ctx * uctx)
-{
- return ((pe_get_named_section_index(uctx->meta,".CRT") >= 0)
- && (pe_get_named_section_index(uctx->meta,".bss") >= 0)
- && (pe_get_named_section_index(uctx->meta,".tls") >= 0));
-}
-
-static const char * pretty_framework(const struct pe_unit_ctx * uctx)
-{
- if (pe_get_named_section_index(uctx->meta,".midipix") >= 0)
- return "midipix";
-
- else if (pe_get_named_section_index(uctx->meta,".freestd") >= 0)
- return "freestd";
-
- else if (pe_get_named_section_index(uctx->meta,".cygheap") >= 0)
- return "cygone";
-
- else if (pe_image_is_psxscl(uctx))
- return "psxscl";
-
- else if (pe_image_is_cygwin(uctx))
- return "cygwin";
-
- else if (pe_image_is_msys(uctx))
- return "msys";
-
- else if (pe_image_is_mingw(uctx))
- return "mingw";
-
- else if (uctx->meta->opt.img.subsystem == PE_IMAGE_SUBSYSTEM_POSIX_CUI)
- return "suacon";
-
- else if (uctx->meta->opt.img.subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_CUI)
- return "wincon";
-
- else if (uctx->meta->opt.img.subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_GUI)
- return "win32";
-
- else
- return "unknown";
-}
-
int pe_output_image_type(
const struct pe_driver_ctx * dctx,
const struct pe_unit_ctx * uctx,
FILE * fout)
{
+ struct pe_info_string framework;
+ const struct pe_image_meta * meta = uctx->meta;
+
if (!fout)
fout = stdout;
+ 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,
pretty_abi(uctx),
pretty_type(uctx),
pretty_subsystem(uctx),
- pretty_framework(uctx)) < 0)
+ 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),
- pretty_framework(uctx)) < 0)
+ framework.buffer) < 0)
return PERK_FILE_ERROR(dctx);
}