summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/plugin.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-09-18 20:12:26 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-09-18 20:12:26 (GMT)
commitaa3cb06f056ccf1a0467eaff8aa4b40701902f5e (patch)
treedde8cdc10459f932235ee8709dda3ae6b164c752 /plugins/pychrysalide/plugin.c
parent175e8193759e01b45b1f6d2d7970e2993ec8c364 (diff)
Removed the old way to load binaries.
Diffstat (limited to 'plugins/pychrysalide/plugin.c')
-rw-r--r--plugins/pychrysalide/plugin.c138
1 files changed, 0 insertions, 138 deletions
diff --git a/plugins/pychrysalide/plugin.c b/plugins/pychrysalide/plugin.c
index b957eff..321fda9 100644
--- a/plugins/pychrysalide/plugin.c
+++ b/plugins/pychrysalide/plugin.c
@@ -32,8 +32,6 @@
#include <common/extstr.h>
-#include "../../src/core/formats.h"
-//#include <core/formats.h>
#include <plugins/plugin-int.h>
@@ -88,9 +86,6 @@ static bool g_python_plugin_do_exit(GPythonPlugin *);
/* Procède à une opération liée à un contenu binaire. */
static void g_python_plugin_handle_binary_content(const GPythonPlugin *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *);
-/* Indique si le format peut être pris en charge ici. */
-FormatMatchStatus python_plugin_is_matching(GBinContent *, GExeFormat *, GPythonPlugin *, char **);
-
/* Exécute une action pendant un désassemblage de binaire. */
static void g_python_plugin_process_disass(const GPythonPlugin *, PluginAction, GLoadedBinary *, GtkStatusStack *, GProcContext *);
@@ -387,22 +382,6 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename)
switch (action)
{
- case PGA_FORMAT_MATCHER:
-
- if (!has_python_method(instance, "is_format_matching"))
- {
- log_variadic_message(LMT_ERROR,
- _("No '%s' entry in plugin candidate '%s'"),
- "is_format_matching",
- G_PLUGIN_MODULE(result)->filename);
- goto gppn_bad_plugin;
- }
-
- if (!register_format_matcher((format_match_fc)python_plugin_is_matching, result))
- goto gppn_bad_plugin;
-
- break;
-
case PGA_FORMAT_LOADER_LAST:
/* TODO */
break;
@@ -683,122 +662,6 @@ static void g_python_plugin_handle_binary_content(const GPythonPlugin *plugin, P
/******************************************************************************
* *
-* Paramètres : content = contenu binaire à parcourir. *
-* parent = éventuel format exécutable déjà chargé. *
-* plugin = grefon C interne représentant le grefon Python. *
-* key = identifiant de format trouvé ou NULL. [OUT] *
-* *
-* Description : Indique si le format peut être pris en charge ici. *
-* *
-* Retour : Conclusion de haut niveau sur la reconnaissance effectuée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-FormatMatchStatus python_plugin_is_matching(GBinContent *content, GExeFormat *parent, GPythonPlugin *plugin, char **key)
-{
- FormatMatchStatus result; /* Bilan à renvoyer */
- PyObject *args; /* Arguments pour l'appel */
- PyObject *value; /* Valeur obtenue */
- PyObject *arg; /* Argument en élément de tuple*/
-
- result = FMS_UNKNOWN;
-
- args = PyTuple_New(2);
- PyTuple_SetItem(args, 0, pygobject_new(G_OBJECT(content)));
- PyTuple_SetItem(args, 1, pygobject_new(G_OBJECT(parent)));
-
- value = run_python_method(plugin->instance, "is_format_matching", args);
-
- if (PyTuple_Check(value))
- {
- if (PyTuple_Size(value) > 0)
- {
- arg = PyTuple_GetItem(value, 0);
-
- if (PyLong_Check(arg))
- {
- result = PyLong_AsLong(arg);
-
- switch (result)
- {
- case FMS_MATCHED:
-
- if (PyTuple_Size(value) != 2)
- {
- g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR,
- _("Expecting only a tuple [ status, key ] " \
- "as result for format matching."));
- result = FMS_UNKNOWN;
- break;
- }
-
- arg = PyTuple_GetItem(value, 1);
-
- if (PyUnicode_Check(arg))
- *key = strdup(PyUnicode_AsUTF8(arg));
-
- else
- {
- g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR,
- _("Expecting a key string for format matching."));
- result = FMS_UNKNOWN;
- }
-
- break;
-
- case FMS_FORWARDED:
- case FMS_UNKNOWN:
- if (PyTuple_Size(value) != 1)
- {
- g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_WARNING,
- _("Unused second item for format matching."));
- }
- break;
-
- default:
- g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR,
- _("Unexpected result for format matching."));
- result = FMS_UNKNOWN;
- break;
-
- }
-
- }
-
- else
- {
- g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR,
- _("Unexpected result status for format matching."));
- result = FMS_UNKNOWN;
- }
-
- }
- else
- g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_WARNING,
- _("Interpreting a empty tuple as FMS_UNKNOWN " \
- "for format matching."));
-
- }
- else
- g_plugin_module_log_variadic_message(G_PLUGIN_MODULE(plugin), LMT_ERROR,
- _("Expected a tuple containing [ status, key ] as result " \
- "for format matching."));
-
- Py_XDECREF(value);
- Py_DECREF(args);
-
- return result;
-
-
-
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : plugin = greffon à manipuler. *
* action = type d'action attendue. *
* binary = binaire dont le contenu est en cours de traitement.*
@@ -862,7 +725,6 @@ static bool py_plugin_module_define_constants(PyTypeObject *obj_type)
result &= PyDict_AddIntMacro(obj_type, PGA_PLUGIN_EXIT);
result &= PyDict_AddIntMacro(obj_type, PGA_CONTENT_EXPLORER);
result &= PyDict_AddIntMacro(obj_type, PGA_CONTENT_RESOLVER);
- result &= PyDict_AddIntMacro(obj_type, PGA_FORMAT_MATCHER);
result &= PyDict_AddIntMacro(obj_type, PGA_FORMAT_LOADER_LAST);
result &= PyDict_AddIntMacro(obj_type, PGA_DISASSEMBLY_STARTED);
result &= PyDict_AddIntMacro(obj_type, PGA_DISASSEMBLY_RAW);