summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-05-05 21:58:46 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-05-05 21:59:01 (GMT)
commita66f854ce4e19dc0f772fc55a3899643252afa3d (patch)
tree52e46f77acc199904a73e2260117a3a5198aeb86 /src/plugins
parent07768223823d8c2b0071be8d8e6dfc5ccb891b17 (diff)
Inserted preloaded format information from instructions instead of symbols.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/pglist.h3
-rw-r--r--src/plugins/plugin-def.h3
-rw-r--r--src/plugins/plugin-int.h5
-rw-r--r--src/plugins/plugin.c29
-rw-r--r--src/plugins/plugin.h4
5 files changed, 42 insertions, 2 deletions
diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h
index 53556b3..e085102 100644
--- a/src/plugins/pglist.h
+++ b/src/plugins/pglist.h
@@ -68,7 +68,8 @@ const GPluginModule **get_all_plugins_for_action(PluginAction, size_t *);
#define handle_binary_format(a, f, s) \
process_all_plugins_for(a, g_plugin_module_handle_binary_format, f, s)
-
+#define preload_binary_format(a, f, i, s) \
+ process_all_plugins_for(a, g_plugin_module_preload_binary_format, f, i, s)
/* DPS_DISASSEMBLY */
diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h
index b0523e1..7344a06 100644
--- a/src/plugins/plugin-def.h
+++ b/src/plugins/plugin-def.h
@@ -122,6 +122,9 @@ typedef enum _PluginAction
/* Accompagnement du chargement (fin) */
PGA_FORMAT_LOADER_LAST = DPC_BINARY_PROCESSING | DPS_FORMAT | DEFINE_PLUGIN_ACTION(1),
+ /* Accompagnement du chargement (fin) */
+ PGA_FORMAT_PRELOAD = DPC_BINARY_PROCESSING | DPS_FORMAT | DEFINE_PLUGIN_ACTION(2),
+
/**
* DPC_BINARY_PROCESSING | DPS_DISASSEMBLY
*/
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h
index 6f02369..7ccd2a6 100644
--- a/src/plugins/plugin-int.h
+++ b/src/plugins/plugin-int.h
@@ -51,6 +51,9 @@ typedef void (* pg_process_disassembly_fc) (const GPluginModule *, PluginAction,
/* Procède à une opération liée au format de fichier uniquement. */
typedef bool (* pg_handle_format) (const GPluginModule *, PluginAction, GBinFormat *, GtkStatusStack *);
+/* Procède à un préchargement de format de fichier. */
+typedef bool (* pg_preload_format) (const GPluginModule *, PluginAction, GBinFormat *, GPreloadInfo *, GtkStatusStack *);
+
@@ -109,7 +112,7 @@ struct _GPluginModule
//pg_format_is_matching is_matching; /* Recherche de correspondance */
pg_handle_format handle_format; /* Manipulation du format */
-
+ pg_preload_format preload_format; /* Préchargement d'un format */
};
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 7a5c680..0c287d6 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -279,6 +279,12 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
goto bad_plugin;
break;
+ case PGA_FORMAT_PRELOAD:
+ if (!load_plugin_symbol(result->module,
+ "preload_binary_format", &result->preload_format))
+ goto bad_plugin;
+ break;
+
default:
log_variadic_message(LMT_WARNING,
_("Unknown action '0x%02x' in plugin '%s'..."),
@@ -509,6 +515,29 @@ bool g_plugin_module_handle_binary_format(const GPluginModule *plugin, PluginAct
* *
* Paramètres : plugin = greffon à manipuler. *
* action = type d'action attendue. *
+* format = format de binaire à manipuler pendant l'opération. *
+* info = informations à constituer en avance de phase. *
+* status = barre de statut à tenir informée. *
+* *
+* Description : Procède à un préchargement de format de fichier. *
+* *
+* Retour : Bilan de l'exécution du traitement. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool g_plugin_module_preload_binary_format(const GPluginModule *plugin, PluginAction action, GBinFormat *format, GPreloadInfo *info, GtkStatusStack *status)
+{
+ return plugin->preload_format(plugin, action, format, info, status);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : plugin = greffon à manipuler. *
+* action = type d'action attendue. *
* binary = binaire dont le contenu est en cours de traitement. *
* *
* Description : Exécute une action pendant un désassemblage de binaire. *
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index e09189d..bc52c93 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -32,6 +32,7 @@
#include "plugin-def.h"
#include "../analysis/binary.h"
#include "../format/format.h"
+#include "../format/preload.h"
#include "../gtkext/gtkstatusstack.h"
@@ -66,6 +67,9 @@ const plugin_interface *g_plugin_module_get_interface(const GPluginModule *);
/* Procède à une opération liée au format de fichier uniquement. */
bool g_plugin_module_handle_binary_format(const GPluginModule *, PluginAction, GBinFormat *, GtkStatusStack *);
+/* Procède à un préchargement de format de fichier. */
+bool g_plugin_module_preload_binary_format(const GPluginModule *, PluginAction, GBinFormat *, GPreloadInfo *, GtkStatusStack *);
+
/* Exécute une action pendant un désassemblage de binaire. */
void g_plugin_module_process_disassembly_event(const GPluginModule *, PluginAction, GLoadedBinary *);