summaryrefslogtreecommitdiff
path: root/src/plugins/plugin.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-04-29 17:13:36 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-04-29 17:13:36 (GMT)
commite2f87e6e92a361cdd66b6867f51dda2abb1ed1b3 (patch)
tree2c3b5473c6042f64c145eb25cf923be8935ae793 /src/plugins/plugin.c
parent1e9b23fb37755fef5992f65cb9862fab271e13d9 (diff)
Saved the current work on the overjump plugin.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@61 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/plugins/plugin.c')
-rw-r--r--src/plugins/plugin.c77
1 files changed, 76 insertions, 1 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index f21ac02..80daa74 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -30,6 +30,8 @@
+
+
/* Procède à l'initialisation du greffon */
typedef bool (* init_plugin_fc) (GObject *);
@@ -42,8 +44,12 @@ struct _GPluginModule
GModule *module; /* Abstration de manipulation */
+ PluginAction action; /* Opération(s) menée(s) */
+
init_plugin_fc init; /* Procédure d'initialisation */
+ disassemble_binary_parts_fc disassemble;/* Fonction de désassemblage */
+
};
@@ -104,7 +110,6 @@ static void g_plugin_module_init(GPluginModule *line)
}
-
/******************************************************************************
* *
* Paramètres : filename = nom du fichier à charger. *
@@ -121,6 +126,8 @@ static void g_plugin_module_init(GPluginModule *line)
GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
{
GPluginModule *result; /* Structure à retourner */
+ get_plugin_action_fc __get_action; /* Actions du greffon */
+
result = g_object_new(G_TYPE_PLUGIN_MODULE, NULL);
@@ -128,6 +135,32 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
result->module = g_module_open(filename, G_MODULE_BIND_LAZY);
+
+ if (!g_module_symbol(result->module, "get_plugin_action", (gpointer *)&__get_action))
+ {
+ printf("Err plugin get_action sym\n");
+ //g_object_destroy(result);
+ return NULL;
+ }
+
+ result->action = __get_action();
+
+
+ /* ... */
+ if (result->action & PGA_DISASSEMBLE)
+ {
+ if (!g_module_symbol(result->module, "disassemble_binary_parts", (gpointer *)&result->disassemble))
+ {
+ printf("Err plugin disass sym\n");
+ //g_object_destroy(result);
+ return NULL;
+ }
+
+
+ }
+
+
+
if (!g_module_symbol(result->module, "init_plugin", (gpointer *)&result->init))
{
printf("Err plugin init sym\n");
@@ -136,9 +169,51 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
+
+
+
if (!result->init(ref))
printf("Err loading pg\n");
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : plugin = greffon à consulter. *
+* *
+* Description : Indique les opérations offertes par un greffon donné. *
+* *
+* Retour : Action(s) offerte(s) par le greffon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PluginAction g_plugin_module_get_action(const GPluginModule *plugin)
+{
+ return plugin->action;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : plugin = greffon à consulter. *
+* binary = binaire dont le contenu est à désassembler. *
+* *
+* Description : S'occupe du désassemblage (pur) de code binaire. *
+* *
+* Retour : Lignes de code pour la représentation à insérer. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GRenderingLine *g_plugin_module_disassemble_binary_parts(const GPluginModule *plugin, openida_binary *binary)
+{
+ return plugin->disassemble(binary);
+
+}