summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-11-14 23:24:09 -0500
committermidipix <writeonce@midipix.org>2016-11-14 23:31:16 -0500
commitb64d661dc38805d6ad5798be568fa8c41720df5c (patch)
tree30ca45e2dd3c6f596e8457b6384c82be7212b948 /src/logic
parent50a83023049b526a0c89165ee81cf7d9ed7eb5a2 (diff)
downloadperk-b64d661dc38805d6ad5798be568fa8c41720df5c.tar.bz2
perk-b64d661dc38805d6ad5798be568fa8c41720df5c.tar.xz
project: source tree layout: moved info source files under src/info.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/pe_get_image_abi.c40
-rw-r--r--src/logic/pe_get_image_framework.c104
-rw-r--r--src/logic/pe_get_image_subsystem.c47
-rw-r--r--src/logic/pe_get_image_subtype.c35
4 files changed, 0 insertions, 226 deletions
diff --git a/src/logic/pe_get_image_abi.c b/src/logic/pe_get_image_abi.c
deleted file mode 100644
index 7219ba3..0000000
--- a/src/logic/pe_get_image_abi.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/***************************************************************/
-/* perk: PE Resource Kit */
-/* Copyright (C) 2015--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.PERK. */
-/***************************************************************/
-
-#include <string.h>
-
-#include <perk/perk.h>
-#include <perk/perk_meta.h>
-
-static const char const * pe_abi_str[PE_ABI_CAP] = {
- [PE_ABI_UNSUPPORTED] = "UNSUPPORTED",
- [PE_ABI_PE32] = "PE32",
- [PE_ABI_PE64] = "PE64",
-};
-
-int pe_get_image_abi(const struct pe_image_meta * m, struct pe_info_string * infostr)
-{
- int abi;
-
- switch (m->opt.std.magic) {
- case PE_MAGIC_PE32:
- abi = PE_ABI_PE32;
- break;
-
- case PE_MAGIC_PE32_PLUS:
- abi = PE_ABI_PE64;
- break;
-
- default:
- abi = PE_ABI_UNSUPPORTED;
- break;
- }
-
- if (infostr)
- strcpy(infostr->buffer,pe_abi_str[abi]);
-
- return abi;
-}
diff --git a/src/logic/pe_get_image_framework.c b/src/logic/pe_get_image_framework.c
deleted file mode 100644
index ba44d2f..0000000
--- a/src/logic/pe_get_image_framework.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/***************************************************************/
-/* perk: PE Resource Kit */
-/* Copyright (C) 2015--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.PERK. */
-/***************************************************************/
-
-#include <string.h>
-#include <stdbool.h>
-
-#include <perk/perk.h>
-#include <perk/perk_meta.h>
-
-static const char const * pe_framework_str[PE_FRAMEWORK_CAP] = {
- [PE_FRAMEWORK_UNKNOWN] = "unknown",
- [PE_FRAMEWORK_FREESTD] = "freestd",
- [PE_FRAMEWORK_PSXSCL] = "psxscl",
- [PE_FRAMEWORK_MIDIPIX] = "midipix",
- [PE_FRAMEWORK_CYGONE] = "cygone",
- [PE_FRAMEWORK_CYGWIN] = "cygwin",
- [PE_FRAMEWORK_MINGW] = "mingw",
- [PE_FRAMEWORK_MSYS] = "msys",
- [PE_FRAMEWORK_SUACON] = "suacon",
- [PE_FRAMEWORK_WINCON] = "wincon",
- [PE_FRAMEWORK_WINCLI] = "wincli",
- [PE_FRAMEWORK_WIN32] = "win32",
-};
-
-static bool pe_image_is_psxscl(const struct pe_image_meta * m)
-{
- return (!m->summary.nimplibs
- && !pe_get_expsym_by_name(m,"__psx_init",0));
-}
-
-static bool pe_image_is_cygwin(const struct pe_image_meta * m)
-{
- int i;
-
- for (i=0; i<m->summary.nimplibs; i++)
- if (!(strcmp(m->idata[i].name,"cygwin1.dll")))
- return true;
-
- return false;
-}
-
-static bool pe_image_is_msys(const struct pe_image_meta * m)
-{
- int i;
-
- for (i=0; i<m->summary.nimplibs; i++)
- if (!(strcmp(m->idata[i].name,"msys-2.0.dll")))
- return true;
-
- return false;
-}
-
-static bool pe_image_is_mingw(const struct pe_image_meta * m)
-{
- return ((pe_get_named_section_index(m,".CRT") >= 0)
- && (pe_get_named_section_index(m,".bss") >= 0)
- && (pe_get_named_section_index(m,".tls") >= 0));
-}
-
-int pe_get_image_framework(const struct pe_image_meta * m, struct pe_info_string * infostr)
-{
- int framework;
-
- if (pe_get_named_section_index(m,".midipix") >= 0)
- framework = PE_FRAMEWORK_MIDIPIX;
-
- else if (pe_get_named_section_index(m,".freestd") >= 0)
- framework = PE_FRAMEWORK_FREESTD;
-
- else if (pe_get_named_section_index(m,".cygheap") >= 0)
- framework = PE_FRAMEWORK_CYGONE;
-
- else if (pe_image_is_psxscl(m))
- framework = PE_FRAMEWORK_PSXSCL;
-
- else if (pe_image_is_cygwin(m))
- framework = PE_FRAMEWORK_CYGWIN;
-
- else if (pe_image_is_msys(m))
- framework = PE_FRAMEWORK_MSYS;
-
- else if (pe_image_is_mingw(m))
- framework = PE_FRAMEWORK_MINGW;
-
- else if (m->opt.img.subsystem == PE_IMAGE_SUBSYSTEM_POSIX_CUI)
- framework = PE_FRAMEWORK_SUACON;
-
- else if (m->opt.img.subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_CUI)
- framework = PE_FRAMEWORK_WINCON;
-
- else if (m->opt.img.subsystem == PE_IMAGE_SUBSYSTEM_WINDOWS_GUI)
- framework = PE_FRAMEWORK_WIN32;
-
- else
- framework = PE_FRAMEWORK_UNKNOWN;
-
- if (infostr)
- strcpy(infostr->buffer,pe_framework_str[framework]);
-
- return framework;
-}
diff --git a/src/logic/pe_get_image_subsystem.c b/src/logic/pe_get_image_subsystem.c
deleted file mode 100644
index 3ccf0e6..0000000
--- a/src/logic/pe_get_image_subsystem.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/***************************************************************/
-/* perk: PE Resource Kit */
-/* Copyright (C) 2015--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.PERK. */
-/***************************************************************/
-
-#include <string.h>
-
-#include <perk/perk.h>
-#include <perk/perk_meta.h>
-
-static const char const * pe_subsystem_str[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"
-};
-
-int pe_get_image_subsystem(const struct pe_image_meta * m, struct pe_info_string * infostr)
-{
- int subsystem;
-
- if (m->opt.img.subsystem >= 0x10)
- subsystem = -1;
-
- else if (!pe_subsystem_str[m->opt.img.subsystem])
- subsystem = -1;
-
- else
- subsystem = m->opt.img.subsystem;
-
- if ((subsystem < 0) && infostr) {
- strcpy(infostr->buffer,"INVALID");
- return subsystem;
- }
-
- if (infostr)
- strcpy(infostr->buffer,pe_subsystem_str[subsystem]);
-
- return subsystem;
-}
diff --git a/src/logic/pe_get_image_subtype.c b/src/logic/pe_get_image_subtype.c
deleted file mode 100644
index 7e19ef1..0000000
--- a/src/logic/pe_get_image_subtype.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/***************************************************************/
-/* perk: PE Resource Kit */
-/* Copyright (C) 2015--2016 Z. Gilboa */
-/* Released under GPLv2 and GPLv3; see COPYING.PERK. */
-/***************************************************************/
-
-#include <string.h>
-
-#include <perk/perk.h>
-#include <perk/perk_meta.h>
-
-/* todo: object, unrecognized */
-
-static const char const * pe_subtype_str[PE_SUBTYPE_CAP] = {
- [PE_SUBTYPE_UNRECOGNIZED] = "UNRECOGNIZED",
- [PE_SUBTYPE_DLL] = "dll",
- [PE_SUBTYPE_EXE] = "exe",
- [PE_SUBTYPE_OBJ] = "obj",
-};
-
-int pe_get_image_subtype(const struct pe_image_meta * m, struct pe_info_string * infostr)
-{
- int subtype;
-
- if (m->coff.characteristics & PE_IMAGE_FILE_DLL)
- subtype = PE_SUBTYPE_DLL;
-
- else
- subtype = PE_SUBTYPE_EXE;
-
- if (infostr)
- strcpy(infostr->buffer,pe_subtype_str[subtype]);
-
- return subtype;
-}