summaryrefslogtreecommitdiff
path: root/src/analysis/project.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/project.c')
-rw-r--r--src/analysis/project.c116
1 files changed, 92 insertions, 24 deletions
diff --git a/src/analysis/project.c b/src/analysis/project.c
index 4251dcc..5775d72 100644
--- a/src/analysis/project.c
+++ b/src/analysis/project.c
@@ -103,6 +103,12 @@ static void g_study_project_class_init(GStudyProjectClass *);
/*Initialise une instance de projet d'étude. */
static void g_study_project_init(GStudyProject *);
+/* Acquitte la fin d'un chargement différé et complet. */
+static void ack_loaded_binary_with_content(GBinaryLoader *, GStudyProject *);
+
+/* Acquitte la fin d'un chargement différé et complet. */
+static void ack_loaded_binary(GBinaryLoader *, GStudyProject *);
+
/* Supprime de l'écran un projet en place. */
static void g_study_project_hide(const GStudyProject *);
@@ -233,7 +239,8 @@ GStudyProject *g_study_project_new(GObject *ref)
/******************************************************************************
* *
-* Paramètres : filename = chemin d'accès au fichier à charger. *
+* Paramètres : ref = espace de référencements global. *
+* filename = chemin d'accès au fichier à charger. *
* *
* Description : Crée un projet à partir du contenu XML d'un fichier. *
* *
@@ -258,7 +265,8 @@ GStudyProject *g_study_project_open(GObject *ref, const char *filename)
long state; /* Etat de ce contenu binaire */
bool status; /* Bilan d'une lecture */
GDelayedStudy *dstudy; /* Etude complémentaire à mener*/
- GLoadedBinary *binary; /* Représentation à intégrer */
+ GBinaryLoader *loader; /* Dispositif de chargement */
+ GWorkQueue *queue; /* Gestionnaire de différés */
if (!open_xml_file(filename, &xdoc, &context)) return NULL;
@@ -343,17 +351,14 @@ GStudyProject *g_study_project_open(GObject *ref, const char *filename)
access = calloc(access_len, sizeof(char));
snprintf(access, access_len, "/ChrysalideProject/Binaries/Binary[position()=%u]", i + 1);
- binary = g_loaded_binary_new_from_xml(context, access, result);
+ loader = g_binary_loader_new_from_xml(filename, access, result);
free(access);
- if (binary != NULL)
- {
- g_signal_connect_to_main(binary, "disassembly-done",
- G_CALLBACK(g_study_project_add_loaded_binary), result,
- g_cclosure_marshal_VOID__VOID);
- g_loaded_binary_analyse(binary);
- }
+ g_signal_connect(loader, "work-completed", G_CALLBACK(ack_loaded_binary), result);
+
+ queue = get_work_queue();
+ g_work_queue_schedule_work(queue, G_DELAYED_WORK(loader), DEFAULT_WORK_GROUP);
}
@@ -550,6 +555,76 @@ GBinContent *g_study_project_find_binary_content_by_hash(GStudyProject *project,
}
+/******************************************************************************
+* *
+* Paramètres : loader = travail de chargement mené à bien. *
+* project = lieu d'intégration des résultats obtenus. *
+* *
+* Description : Acquitte la fin d'un chargement différé et complet. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void ack_loaded_binary_with_content(GBinaryLoader *loader, GStudyProject *project)
+{
+ GLoadedBinary *binary; /* Binaire désormais en place */
+ GExeFormat *format; /* Format de données reconnu */
+ GBinContent *content; /* Contenu binaire d'origine */
+
+ binary = g_binary_loader_get_result(loader);
+
+ if (binary != NULL)
+ {
+ format = g_loaded_binary_get_format(binary);
+ content = g_binary_format_get_content(G_BIN_FORMAT(format));
+
+ g_study_project_add_binary_content(project, content, PCS_ROOT/* FIXME : dstudy->state*/);
+
+ g_object_unref(G_OBJECT(content));
+ g_object_unref(G_OBJECT(format));
+
+ ack_loaded_binary(loader, project);
+
+ g_object_unref(G_OBJECT(binary));
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : loader = travail de chargement mené à bien. *
+* project = lieu d'intégration des résultats obtenus. *
+* *
+* Description : Acquitte la fin d'un chargement différé et complet. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void ack_loaded_binary(GBinaryLoader *loader, GStudyProject *project)
+{
+ GLoadedBinary *binary; /* Binaire désormais en place */
+
+ binary = g_binary_loader_get_result(loader);
+
+ if (binary != NULL)
+ {
+ g_signal_connect_to_main(binary, "disassembly-done",
+ G_CALLBACK(g_study_project_add_loaded_binary), project,
+ g_cclosure_marshal_VOID__VOID);
+
+ g_loaded_binary_analyse(binary);
+
+ }
+
+}
/******************************************************************************
@@ -1126,8 +1201,6 @@ void push_project_into_recent_list(const GStudyProject *project)
/* Constitution de la liste des projets récents */
- /* Constitution de la liste des projets récents */
-
manager = get_projects_manager();
qualified = (char *)calloc(strlen("file://") + strlen(project->filename) + 1, sizeof(char));
@@ -1300,7 +1373,8 @@ static void g_delayed_study_process(GDelayedStudy *dstudy, GtkStatusStack *statu
{
FormatMatchStatus mstatus; /* Statut d'une reconnaissance */
char *target; /* Sous-traitance requise */
- GLoadedBinary *binary; /* Représentation chargée */
+ GBinaryLoader *loader; /* Dispositif de chargement */
+ GWorkQueue *queue; /* Gestionnaire de différés */
mstatus = find_matching_format(dstudy->content, NULL, &target);
@@ -1313,19 +1387,13 @@ static void g_delayed_study_process(GDelayedStudy *dstudy, GtkStatusStack *statu
else
{
- binary = g_loaded_binary_new(dstudy->content);
-
- if (binary != NULL)
- {
- g_study_project_add_binary_content(dstudy->project, dstudy->content, dstudy->state);
-
- g_signal_connect_to_main(binary, "disassembly-done",
- G_CALLBACK(g_study_project_add_loaded_binary),
- dstudy->project, g_cclosure_marshal_VOID__VOID);
+ loader = g_binary_loader_new(dstudy->content);
- g_loaded_binary_analyse(binary);
+ g_signal_connect(loader, "work-completed", G_CALLBACK(ack_loaded_binary_with_content),
+ dstudy->project);
- }
+ queue = get_work_queue();
+ g_work_queue_schedule_work(queue, G_DELAYED_WORK(loader), DEFAULT_WORK_GROUP);
}