summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-11-22 23:43:14 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-11-22 23:43:14 (GMT)
commit9428bf292d066055d168b9bb49fe90c41f2942d1 (patch)
tree9d4d75a414f058dc7015401d8fada63ec24fe14b /src/analysis
parent3669bdaf8552f53baa5cfb2b0d360959eea61236 (diff)
Replaced the text of some registers (this and parameters).
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@289 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/disass/disassembler.c52
1 files changed, 21 insertions, 31 deletions
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index 73d75cf..6d0bd61 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -60,13 +60,13 @@ typedef struct _GDelayedDisassembly
{
GDelayedWork parent; /* A laisser en premier */
- const GLoadedBinary *binary; /* Destinataire final */
- const GExeFormat *format; /* Format du binaire représenté*/
+ GLoadedBinary *binary; /* Destinataire final */
+ GExeFormat *format; /* Format du binaire représenté*/
GBinPart **parts; /* Parties binaires à traiter */
size_t count; /* Nombre de ces parties */
- GArchInstruction *instrs; /* Instructions résultantes */
+ GArchInstruction **instrs; /* Instructions résultantes */
GCodeBuffer *buffer; /* Tampon pour le rendu */
} GDelayedDisassembly;
@@ -89,7 +89,7 @@ static void g_delayed_disassembly_class_init(GDelayedDisassemblyClass *);
static void g_delayed_disassembly_init(GDelayedDisassembly *);
/* Crée une tâche de désassemblage différé. */
-static GDelayedDisassembly *g_delayed_disassembly_new(const GLoadedBinary *, GBinPart **, size_t, GCodeBuffer *);
+static GDelayedDisassembly *g_delayed_disassembly_new(GLoadedBinary *, GBinPart **, size_t, GArchInstruction **, GCodeBuffer *);
/* Assure le désassemblage en différé. */
static void g_delayed_disassembly_process(GDelayedDisassembly *, GtkExtStatusBar *);
@@ -155,6 +155,7 @@ static void g_delayed_disassembly_init(GDelayedDisassembly *disass)
* format = format du binaire représenté. *
* parts = parties binaires à désassembler. *
* count = nombre de parties à traiter. *
+* instrs = emplacement pour la liste d'instructions. *
* buffer = tampon de sortie pour les instructions. *
* *
* Description : Crée une tâche de désassemblage différé. *
@@ -165,7 +166,7 @@ static void g_delayed_disassembly_init(GDelayedDisassembly *disass)
* *
******************************************************************************/
-static GDelayedDisassembly *g_delayed_disassembly_new(const GLoadedBinary *binary, GBinPart **parts, size_t count, GCodeBuffer *buffer)
+static GDelayedDisassembly *g_delayed_disassembly_new(GLoadedBinary *binary, GBinPart **parts, size_t count, GArchInstruction **instrs, GCodeBuffer *buffer)
{
GDelayedDisassembly *result; /* Tâche à retourner */
@@ -177,6 +178,7 @@ static GDelayedDisassembly *g_delayed_disassembly_new(const GLoadedBinary *binar
result->parts = parts;
result->count = count;
+ result->instrs = instrs;
result->buffer = buffer;
return result;
@@ -216,8 +218,8 @@ static void g_delayed_disassembly_process(GDelayedDisassembly *disass, GtkExtSta
id = gtk_extended_status_bar_push(statusbar, _("Disassembling..."), true);
- disass->instrs = disassemble_binary_parts(disass->binary, disass->parts, disass->count,
- statusbar, id);
+ *disass->instrs = disassemble_binary_parts(disass->binary, disass->parts, disass->count,
+ statusbar, id);
gtk_extended_status_bar_remove(statusbar, id);
@@ -239,35 +241,43 @@ static void g_delayed_disassembly_process(GDelayedDisassembly *disass, GtkExtSta
#endif
+ run_plugins_on_binary(disass->binary, PGA_BINARY_DISASSEMBLED);
+
/* Seconde étape */
id = gtk_extended_status_bar_push(statusbar, _("Establishing links..."), true);
- establish_links_between_lines(disass->instrs, routines, routines_count, statusbar, id);
+ establish_links_between_lines(*disass->instrs, routines, routines_count, statusbar, id);
gtk_extended_status_bar_remove(statusbar, id);
+ run_plugins_on_binary(disass->binary, PGA_BINARY_LINKED);
+
/* Troisième étape */
id = gtk_extended_status_bar_push(statusbar, _("Finding remaining limits..."), true);
qsort(routines, routines_count, sizeof(GBinRoutine *), (__compar_fn_t)g_binary_routine_rcompare);
- limit_all_routines(disass->instrs, routines, routines_count, statusbar, id);
+ limit_all_routines(*disass->instrs, routines, routines_count, statusbar, id);
gtk_extended_status_bar_remove(statusbar, id);
+ run_plugins_on_binary(disass->binary, PGA_BINARY_BOUNDED);
+
/* Quatrième étape */
id = gtk_extended_status_bar_push(statusbar, _("Printing disassembled code..."), true);
qsort(routines, routines_count, sizeof(GBinRoutine *), (__compar_fn_t)g_binary_routine_compare);
- print_disassembled_instructions(disass->buffer, disass->format, disass->instrs,
+ print_disassembled_instructions(disass->buffer, disass->format, *disass->instrs,
routines, routines_count);
gtk_extended_status_bar_remove(statusbar, id);
+ run_plugins_on_binary(disass->binary, PGA_BINARY_PRINTED);
+
}
@@ -387,39 +397,19 @@ void disassemble_binary(GLoadedBinary *binary, GBinPart **parts, size_t parts_co
off_t length; /* Quantité de ces données */
GDelayedDisassembly *disass; /* Désassemblage à mener */
GWorkQueue *queue; /* Gestionnaire de différés */
- GPluginModule **pglist; /* Liste de greffons */
- size_t pgcount; /* Taille de cette liste */
- size_t i; /* Boucle de parcours */
-
- /* Déroulement de l'opération principale */
*buffer = g_code_buffer_new();
data = g_loaded_binary_get_data(binary, &length);
build_disass_prologue(*buffer, g_loaded_binary_get_filename(binary, true), data, length);
- disass = g_delayed_disassembly_new(binary, parts, parts_count, *buffer);
+ disass = g_delayed_disassembly_new(binary, parts, parts_count, instrs, *buffer);
queue = get_work_queue();
g_work_queue_schedule_work(queue, G_DELAYED_WORK(disass));
g_delayed_work_wait_for_completion(G_DELAYED_WORK(disass));
- *instrs = disass->instrs;
-
g_object_unref(G_OBJECT(disass));
- /* Actions post-désassemblage */
-
- pglist = get_all_plugins_for_action(PGA_DISASS_PROCESS, &pgcount);
-
- if (pgcount > 0)
- {
- for (i = 0; i < pgcount; i++)
- g_plugin_module_execute_action_on_binary(pglist[i], binary, PGA_DISASS_PROCESS);
-
- free(pglist);
-
- }
-
}