summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-04-05 19:22:50 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-04-05 19:22:50 (GMT)
commit929150f18d23d82e8390bd98e31b1edb34bc09f1 (patch)
treed33ca3b894dd9c7cc714a6eac696fade2b813cdf /src
parentc853ed6c88a82e2859033c4111b0edb0372bc570 (diff)
Created a plugin to follow the control.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@149 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src')
-rw-r--r--src/analysis/binary.c19
-rw-r--r--src/analysis/binary.h3
-rw-r--r--src/analysis/line-int.h2
-rw-r--r--src/analysis/line.c63
-rw-r--r--src/analysis/line.h6
-rw-r--r--src/plugins/plugin-def.h5
-rw-r--r--src/plugins/plugin.c5
7 files changed, 97 insertions, 6 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 66cc26d..c35118e 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -1220,6 +1220,25 @@ GRenderingOptions *g_openida_binary_get_options(const GOpenidaBinary *binary)
* *
* Paramètres : binary = élément binaire à consulter. *
* *
+* Description : Donne la racine des lignes de rendu issues du désassemblage. *
+* *
+* Retour : Lieu d'enregistrement des lignes issues du désassemblage. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GRenderingLine **g_openida_binary_get_lines_root(const GOpenidaBinary *binary)
+{
+ return &binary->lines;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : binary = élément binaire à consulter. *
+* *
* Description : Fournit les lignes de rendu issues du désassemblage. *
* *
* Retour : Lignes issues du désassemblage. *
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 533264b..f556c4a 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -98,6 +98,9 @@ GExeFormat *g_openida_binary_get_format(const GOpenidaBinary *);
/* Fournit les options d'affichage définies pour le binaire. */
GRenderingOptions *g_openida_binary_get_options(const GOpenidaBinary *);
+/* Donne la racine des lignes de rendu issues du désassemblage. */
+GRenderingLine **g_openida_binary_get_lines_root(const GOpenidaBinary *);
+
/* Fournit les lignes de rendu issues du désassemblage. */
GRenderingLine *g_openida_binary_get_lines(const GOpenidaBinary *);
diff --git a/src/analysis/line-int.h b/src/analysis/line-int.h
index e240815..38efeda 100644
--- a/src/analysis/line-int.h
+++ b/src/analysis/line-int.h
@@ -62,7 +62,9 @@ struct _GRenderingLine
#define lines_list_prev_iter(iter, head) dl_list_prev_iter(iter, head, GRenderingLine, link)
#define lines_list_add_before(new, head, pos) dl_list_add_before(new, head, pos, link)
#define lines_list_add_tail(new, head) dl_list_add_tail(new, head, GRenderingLine, link)
+#define lines_list_del(item, head) dl_list_del(item, head, GRenderingLine, link)
#define lines_list_for_each(pos, head) dl_list_for_each(pos, head, GRenderingLine, link)
+#define lines_list_for_each_safe(pos, head, next) dl_list_for_each_safe(pos, head, next, GRenderingLine, link)
/* Ligne de représentation générique (classe) */
diff --git a/src/analysis/line.c b/src/analysis/line.c
index a3ba7a5..bb4188a 100644
--- a/src/analysis/line.c
+++ b/src/analysis/line.c
@@ -477,6 +477,69 @@ void g_rendering_line_insert_into_lines(GRenderingLine **lines, GRenderingLine *
/******************************************************************************
* *
+* Paramètres : lines = liste de lignes à compléter, ou NULL. *
+* new = nouvelles lignes à intégrer à l'ensemble. *
+* *
+* Description : Insère des lignes dans un ensemble existant. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_rendering_line_insert_lines(GRenderingLine **lines, GRenderingLine **new)
+{
+ GRenderingLine *iter; /* Boucle de parcours */
+ GRenderingLine *next; /* Ligne suivante à traiter */
+
+ lines_list_for_each_safe(iter, new, next)
+ {
+ lines_list_del(iter, new);
+ g_rendering_line_insert_into_lines(lines, iter, true);
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : lines = liste de lignes à traiter. *
+* start = borne inférieure de l'intervalle (incluse). *
+* end = borne supérieure de l'intervalle (incluse). *
+* *
+* Description : Supprime une série de lignes comprises dans un intervalle. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_rendering_line_remove_range(GRenderingLine **lines, vmpa_t start, vmpa_t end)
+{
+ GRenderingLine *first; /* Première ligne à traiter */
+ GRenderingLine *last; /* Dernière ligne à traiter */
+ GRenderingLine *iter; /* Boucle de parcours */
+ GRenderingLine *next; /* Ligne suivante à traiter */
+
+ first = g_rendering_line_find_by_address(*lines, NULL, start);
+ last = g_rendering_line_find_by_address(*lines, NULL, end);
+
+ for (iter = first; iter != NULL; iter = next)
+ {
+ next = g_rendering_line_get_next_iter(*lines, iter, last);
+
+ lines_list_del(iter, lines);
+ g_object_unref(G_OBJECT(iter));
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : lines = liste de lignes de représentation à actualiser. *
* : iter = position actuelle dans la liste. *
* last = dernière élément imposé du parcours ou NULL. *
diff --git a/src/analysis/line.h b/src/analysis/line.h
index 5061dcd..fbc560f 100644
--- a/src/analysis/line.h
+++ b/src/analysis/line.h
@@ -122,6 +122,12 @@ void g_rendering_line_add_to_lines(GRenderingLine **, GRenderingLine *);
/* Insère une ligne dans un ensemble existant. */
void g_rendering_line_insert_into_lines(GRenderingLine **, GRenderingLine *, bool);
+/* Insère des lignes dans un ensemble existant. */
+void g_rendering_line_insert_lines(GRenderingLine **, GRenderingLine **);
+
+/* Supprime une série de lignes comprises dans un intervalle. */
+void g_rendering_line_remove_range(GRenderingLine **, vmpa_t, vmpa_t);
+
/* Fournit l'élement suivant un autre pour un parcours. */
GRenderingLine *g_rendering_line_get_next_iter(GRenderingLine *, const GRenderingLine *, const GRenderingLine *);
diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h
index 1b47bd6..adbabd4 100644
--- a/src/plugins/plugin-def.h
+++ b/src/plugins/plugin-def.h
@@ -41,14 +41,11 @@ typedef enum _PluginAction
-struct _GPluginModule;
-
-
/* Fournit une indication sur le type d'opération(s) menée(s). */
typedef PluginAction (* get_plugin_action_fc) (void);
/* Exécute une action définie sur un binaire chargé. */
-typedef bool (* execute_action_on_binary_fc) (struct _GPluginModule *, GOpenidaBinary *, PluginAction);
+typedef bool (* execute_action_on_binary_fc) (GOpenidaBinary *, PluginAction);
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index ed4c39d..42bef63 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -107,7 +107,7 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
result->module = g_module_open(filename, G_MODULE_BIND_LAZY);
-#if 0
+#if 1
if (!g_module_symbol(result->module, "get_plugin_action", (gpointer *)&__get_action))
{
printf("Err plugin get_action sym\n");
@@ -144,6 +144,7 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
if (!result->init(ref))
printf("Err loading pg\n");
+ else printf("Loaded '%s' : ok (%p)\n", filename, result);
return result;
@@ -185,6 +186,6 @@ PluginAction g_plugin_module_get_action(const GPluginModule *plugin)
bool g_plugin_module_execute_action_on_binary(const GPluginModule *plugin, GOpenidaBinary *binary, PluginAction action)
{
- return plugin->exec_on_bin(plugin, binary, action);
+ return plugin->exec_on_bin(binary, action);
}