summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-09-11 21:37:36 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-09-11 21:37:36 (GMT)
commit0f1473cba267ad809c8e7d207b5ff5e3998745fc (patch)
tree8aea43688d78c10ee7758e2feed80be9abbfaaf6
parentfe39a487b4db5564036a436bfcb7cf3561889fb5 (diff)
Displayed more details about the loading process in the status bar.
-rw-r--r--ChangeLog28
-rw-r--r--plugins/readdex/class.c11
-rw-r--r--plugins/readdex/class.h2
-rw-r--r--plugins/readdex/ids.c55
-rw-r--r--plugins/readdex/ids.h10
-rw-r--r--plugins/readdex/reader.c15
-rw-r--r--plugins/readdex/reader.h2
-rw-r--r--plugins/readelf/program.c13
-rw-r--r--plugins/readelf/program.h2
-rw-r--r--plugins/readelf/reader.c7
-rw-r--r--plugins/readelf/reader.h2
-rw-r--r--plugins/readelf/section.c13
-rw-r--r--plugins/readelf/section.h2
-rwxr-xr-xsrc/format/dex/dex.c8
-rw-r--r--src/format/dex/pool.c36
-rw-r--r--src/format/dex/pool.h9
-rw-r--r--src/format/elf/elf.c9
-rw-r--r--src/format/format-int.h2
-rw-r--r--src/format/format.c5
-rw-r--r--src/plugins/pglist.h6
-rw-r--r--src/plugins/plugin-int.h2
-rw-r--r--src/plugins/plugin.c5
-rw-r--r--src/plugins/plugin.h2
23 files changed, 192 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index fc0f6cd..8a08249 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,33 @@
16-09-11 Cyrille Bagard <nocbos@gmail.com>
+ * plugins/readdex/class.c:
+ * plugins/readdex/class.h:
+ * plugins/readdex/ids.c:
+ * plugins/readdex/ids.h:
+ * plugins/readdex/reader.c:
+ * plugins/readdex/reader.h:
+ * plugins/readelf/program.c:
+ * plugins/readelf/program.h:
+ * plugins/readelf/reader.c:
+ * plugins/readelf/reader.h:
+ * plugins/readelf/section.c:
+ * plugins/readelf/section.h:
+ * src/format/dex/dex.c:
+ * src/format/dex/pool.c:
+ * src/format/dex/pool.h:
+ * src/format/elf/elf.c:
+ Display more details about the loading process in the status bar.
+
+ * src/format/format-int.h:
+ * src/format/format.c:
+ * src/plugins/pglist.h:
+ * src/plugins/plugin-int.h:
+ * src/plugins/plugin.c:
+ * src/plugins/plugin.h:
+ Update code.
+
+16-09-11 Cyrille Bagard <nocbos@gmail.com>
+
* src/format/dex/dex-int.c:
Fix a bug when decoding some catch-all handlers in Dex code item.
diff --git a/plugins/readdex/class.c b/plugins/readdex/class.c
index d3ca197..64be347 100644
--- a/plugins/readdex/class.c
+++ b/plugins/readdex/class.c
@@ -54,6 +54,7 @@ static bool annotate_dex_encoded_method(const GDexFormat *, const encoded_method
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Commente les définitions des classes pour la VM Dalvik. *
* *
@@ -63,13 +64,14 @@ static bool annotate_dex_encoded_method(const GDexFormat *, const encoded_method
* *
******************************************************************************/
-bool annotate_dex_class_defs(const GDexFormat *format)
+bool annotate_dex_class_defs(const GDexFormat *format, GtkStatusStack *status)
{
bool result; /* Bilan à retourner */
GBinContent *content; /* Contenu binaire à lire */
const dex_header *header; /* En-tête principale */
SourceEndian endian; /* Boutisme utilisé */
vmpa2t pos; /* Tête de lecture des symboles*/
+ activity_id_t msg; /* Message de progression */
uint32_t i; /* Boucle de parcours */
vmpa2t start; /* Localisation des symboles */
GArchInstruction *instr; /* Instruction décodée */
@@ -90,6 +92,9 @@ bool annotate_dex_class_defs(const GDexFormat *format)
if (!g_exe_format_translate_offset_into_vmpa(G_EXE_FORMAT(format), header->class_defs_off, &pos))
return false;
+ msg = gtk_status_stack_add_activity(status, _("Writing annotations for all Dex classes..."),
+ header->class_defs_size);
+
for (i = 0; i < header->class_defs_size && result; i++)
{
/* class_idx */
@@ -209,8 +214,12 @@ bool annotate_dex_class_defs(const GDexFormat *format)
/* TODO : g_object_unref(G_OBJECT(class));*/
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
}
+ gtk_status_stack_remove_activity(status, msg);
+
g_object_unref(G_OBJECT(content));
return result;
diff --git a/plugins/readdex/class.h b/plugins/readdex/class.h
index c2508e3..18b1e49 100644
--- a/plugins/readdex/class.h
+++ b/plugins/readdex/class.h
@@ -30,7 +30,7 @@
/* Commente les définitions des classes pour la VM Dalvik. */
-bool annotate_dex_class_defs(const GDexFormat *);
+bool annotate_dex_class_defs(const GDexFormat *, GtkStatusStack *);
diff --git a/plugins/readdex/ids.c b/plugins/readdex/ids.c
index c9f1cb5..9319b7c 100644
--- a/plugins/readdex/ids.c
+++ b/plugins/readdex/ids.c
@@ -39,6 +39,7 @@
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Commente les définitions des chaînes de caractères. *
* *
@@ -48,12 +49,13 @@
* *
******************************************************************************/
-bool annotate_dex_string_ids(const GDexFormat *format)
+bool annotate_dex_string_ids(const GDexFormat *format, GtkStatusStack *status)
{
GBinContent *content; /* Contenu binaire à lire */
const dex_header *header; /* En-tête principale */
SourceEndian endian; /* Boutisme utilisé */
vmpa2t pos; /* Tête de lecture des symboles*/
+ activity_id_t msg; /* Message de progression */
uint32_t i; /* Boucle de parcours */
vmpa2t start; /* Localisation des symboles */
GArchInstruction *instr; /* Instruction décodée */
@@ -74,6 +76,9 @@ bool annotate_dex_string_ids(const GDexFormat *format)
if (!g_exe_format_translate_offset_into_vmpa(G_EXE_FORMAT(format), header->string_ids_off, &pos))
return false;
+ msg = gtk_status_stack_add_activity(status, _("Writing annotations for all Dex strings..."),
+ header->string_ids_size);
+
for (i = 0; i < header->string_ids_size; i++)
{
/* Saut vers la définition */
@@ -125,8 +130,12 @@ bool annotate_dex_string_ids(const GDexFormat *format)
ADD_STR_AS_SYM(format, symbol, instr);
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
}
+ gtk_status_stack_remove_activity(status, msg);
+
g_object_unref(G_OBJECT(content));
return true;
@@ -137,6 +146,7 @@ bool annotate_dex_string_ids(const GDexFormat *format)
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Commente les définitions des identifiants de types. *
* *
@@ -146,12 +156,13 @@ bool annotate_dex_string_ids(const GDexFormat *format)
* *
******************************************************************************/
-bool annotate_dex_type_ids(const GDexFormat *format)
+bool annotate_dex_type_ids(const GDexFormat *format, GtkStatusStack *status)
{
GBinContent *content; /* Contenu binaire à lire */
const dex_header *header; /* En-tête principale */
SourceEndian endian; /* Boutisme utilisé */
vmpa2t pos; /* Tête de lecture des symboles*/
+ activity_id_t msg; /* Message de progression */
uint32_t i; /* Boucle de parcours */
vmpa2t start; /* Localisation des symboles */
GArchInstruction *instr; /* Instruction décodée */
@@ -168,6 +179,9 @@ bool annotate_dex_type_ids(const GDexFormat *format)
if (!g_exe_format_translate_offset_into_vmpa(G_EXE_FORMAT(format), header->type_ids_off, &pos))
return false;
+ msg = gtk_status_stack_add_activity(status, _("Writing annotations for all Dex types..."),
+ header->type_ids_size);
+
for (i = 0; i < header->type_ids_size; i++)
{
copy_vmpa(&start, &pos);
@@ -184,8 +198,12 @@ bool annotate_dex_type_ids(const GDexFormat *format)
if (i == 0)
g_binary_symbol_define_as_block_start(symbol, true);
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
}
+ gtk_status_stack_remove_activity(status, msg);
+
g_object_unref(G_OBJECT(content));
return true;
@@ -196,6 +214,7 @@ bool annotate_dex_type_ids(const GDexFormat *format)
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Commente les définitions des identifiants de prototypes. *
* *
@@ -205,12 +224,13 @@ bool annotate_dex_type_ids(const GDexFormat *format)
* *
******************************************************************************/
-bool annotate_dex_proto_ids(const GDexFormat *format)
+bool annotate_dex_proto_ids(const GDexFormat *format, GtkStatusStack *status)
{
GBinContent *content; /* Contenu binaire à lire */
const dex_header *header; /* En-tête principale */
SourceEndian endian; /* Boutisme utilisé */
vmpa2t pos; /* Tête de lecture des symboles*/
+ activity_id_t msg; /* Message de progression */
uint32_t i; /* Boucle de parcours */
vmpa2t start; /* Localisation des symboles */
GArchInstruction *instr; /* Instruction décodée */
@@ -227,6 +247,9 @@ bool annotate_dex_proto_ids(const GDexFormat *format)
if (!g_exe_format_translate_offset_into_vmpa(G_EXE_FORMAT(format), header->proto_ids_off, &pos))
return false;
+ msg = gtk_status_stack_add_activity(status, _("Writing annotations for all Dex prototypes..."),
+ header->proto_ids_size);
+
for (i = 0; i < header->proto_ids_size; i++)
{
/* shorty_idx */
@@ -271,8 +294,12 @@ bool annotate_dex_proto_ids(const GDexFormat *format)
free(text);
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
}
+ gtk_status_stack_remove_activity(status, msg);
+
g_object_unref(G_OBJECT(content));
return true;
@@ -283,6 +310,7 @@ bool annotate_dex_proto_ids(const GDexFormat *format)
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Commente les définitions des identifiants de champs. *
* *
@@ -292,12 +320,13 @@ bool annotate_dex_proto_ids(const GDexFormat *format)
* *
******************************************************************************/
-bool annotate_dex_field_ids(const GDexFormat *format)
+bool annotate_dex_field_ids(const GDexFormat *format, GtkStatusStack *status)
{
GBinContent *content; /* Contenu binaire à lire */
const dex_header *header; /* En-tête principale */
SourceEndian endian; /* Boutisme utilisé */
vmpa2t pos; /* Tête de lecture des symboles*/
+ activity_id_t msg; /* Message de progression */
uint32_t i; /* Boucle de parcours */
vmpa2t start; /* Localisation des symboles */
GArchInstruction *instr; /* Instruction décodée */
@@ -314,6 +343,9 @@ bool annotate_dex_field_ids(const GDexFormat *format)
if (!g_exe_format_translate_offset_into_vmpa(G_EXE_FORMAT(format), header->field_ids_off, &pos))
return false;
+ msg = gtk_status_stack_add_activity(status, _("Writing annotations for all Dex fields..."),
+ header->field_ids_size);
+
for (i = 0; i < header->field_ids_size; i++)
{
/* class_idx */
@@ -358,8 +390,12 @@ bool annotate_dex_field_ids(const GDexFormat *format)
free(text);
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
}
+ gtk_status_stack_remove_activity(status, msg);
+
g_object_unref(G_OBJECT(content));
return true;
@@ -370,6 +406,7 @@ bool annotate_dex_field_ids(const GDexFormat *format)
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Commente les définitions des identifiants de méthodes. *
* *
@@ -379,13 +416,14 @@ bool annotate_dex_field_ids(const GDexFormat *format)
* *
******************************************************************************/
-bool annotate_dex_method_ids(const GDexFormat *format)
+bool annotate_dex_method_ids(const GDexFormat *format, GtkStatusStack *status)
{
GBinContent *content; /* Contenu binaire à lire */
const dex_header *header; /* En-tête principale */
SourceEndian endian; /* Boutisme utilisé */
vmpa2t pos; /* Tête de lecture des symboles*/
uint32_t i; /* Boucle de parcours */
+ activity_id_t msg; /* Message de progression */
vmpa2t start; /* Localisation des symboles */
GArchInstruction *instr; /* Instruction décodée */
GArchOperand *operand; /* Opérande à venir modifier */
@@ -401,6 +439,9 @@ bool annotate_dex_method_ids(const GDexFormat *format)
if (!g_exe_format_translate_offset_into_vmpa(G_EXE_FORMAT(format), header->method_ids_off, &pos))
return false;
+ msg = gtk_status_stack_add_activity(status, _("Writing annotations for all Dex methods..."),
+ header->method_ids_size);
+
for (i = 0; i < header->method_ids_size; i++)
{
/* class_idx */
@@ -445,8 +486,12 @@ bool annotate_dex_method_ids(const GDexFormat *format)
free(text);
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
}
+ gtk_status_stack_remove_activity(status, msg);
+
g_object_unref(G_OBJECT(content));
return true;
diff --git a/plugins/readdex/ids.h b/plugins/readdex/ids.h
index bcbf6de..a3251b7 100644
--- a/plugins/readdex/ids.h
+++ b/plugins/readdex/ids.h
@@ -30,19 +30,19 @@
/* Charge tous les symboles de l'en-tête DEX. */
-bool annotate_dex_string_ids(const GDexFormat *);
+bool annotate_dex_string_ids(const GDexFormat *, GtkStatusStack *);
/* Commente les définitions des identifiants de types. */
-bool annotate_dex_type_ids(const GDexFormat *);
+bool annotate_dex_type_ids(const GDexFormat *, GtkStatusStack *);
/* Commente les définitions des identifiants de prototypes. */
-bool annotate_dex_proto_ids(const GDexFormat *);
+bool annotate_dex_proto_ids(const GDexFormat *, GtkStatusStack *);
/* Commente les définitions des identifiants de champs. */
-bool annotate_dex_field_ids(const GDexFormat *);
+bool annotate_dex_field_ids(const GDexFormat *, GtkStatusStack *);
/* Commente les définitions des identifiants de méthodes. */
-bool annotate_dex_method_ids(const GDexFormat *);
+bool annotate_dex_method_ids(const GDexFormat *, GtkStatusStack *);
diff --git a/plugins/readdex/reader.c b/plugins/readdex/reader.c
index 8df489e..6494973 100644
--- a/plugins/readdex/reader.c
+++ b/plugins/readdex/reader.c
@@ -42,6 +42,7 @@ DEFINE_CHRYSALIDE_ACTIVE_PLUGIN("readdex", "Displays information about DEX files
* Paramètres : plugin = greffon à manipuler. *
* action = type d'action attendue. *
* format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Etablit des symboles complémentaires dans un format DEX. *
* *
@@ -51,7 +52,7 @@ DEFINE_CHRYSALIDE_ACTIVE_PLUGIN("readdex", "Displays information about DEX files
* *
******************************************************************************/
-G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *plugin, PluginAction action, GBinFormat *format)
+G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *plugin, PluginAction action, GBinFormat *format, GtkStatusStack *status)
{
bool result; /* Bilan à retourner */
GDexFormat *dex_fmt; /* Version DEX */
@@ -66,17 +67,17 @@ G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *plugin, PluginAct
result = annotate_dex_header(dex_fmt);
- result &= annotate_dex_string_ids(dex_fmt);
+ result &= annotate_dex_string_ids(dex_fmt, status);
- result &= annotate_dex_type_ids(dex_fmt);
+ result &= annotate_dex_type_ids(dex_fmt, status);
- result &= annotate_dex_proto_ids(dex_fmt);
+ result &= annotate_dex_proto_ids(dex_fmt, status);
- result &= annotate_dex_field_ids(dex_fmt);
+ result &= annotate_dex_field_ids(dex_fmt, status);
- result &= annotate_dex_method_ids(dex_fmt);
+ result &= annotate_dex_method_ids(dex_fmt, status);
- result &= annotate_dex_class_defs(dex_fmt);
+ result &= annotate_dex_class_defs(dex_fmt, status);
hbf_exit:
diff --git a/plugins/readdex/reader.h b/plugins/readdex/reader.h
index 8cccced..15fe873 100644
--- a/plugins/readdex/reader.h
+++ b/plugins/readdex/reader.h
@@ -32,7 +32,7 @@
/* Etablit des symboles complémentaires dans un format DEX. */
-G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *, PluginAction, GBinFormat *);
+G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *, PluginAction, GBinFormat *, GtkStatusStack *);
diff --git a/plugins/readelf/program.c b/plugins/readelf/program.c
index f380ce4..0c6574d 100644
--- a/plugins/readelf/program.c
+++ b/plugins/readelf/program.c
@@ -325,6 +325,7 @@ static bool annotate_elf_program_header(GElfFormat *format, SourceEndian endian,
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Charge tous les symboles liés aux en-têtes de programme ELF. *
* *
@@ -334,7 +335,7 @@ static bool annotate_elf_program_header(GElfFormat *format, SourceEndian endian,
* *
******************************************************************************/
-bool annotate_elf_program_header_table(GElfFormat *format)
+bool annotate_elf_program_header_table(GElfFormat *format, GtkStatusStack *status)
{
bool result; /* Bilan à retourner */
const elf_header *header; /* En-tête principale */
@@ -342,6 +343,7 @@ bool annotate_elf_program_header_table(GElfFormat *format)
phys_t offset; /* Tête de lecture du bbinaire */
vmpa2t pos; /* Localisation des symboles */
uint16_t e_phnum; /* Nombre d'éléments 'Program' */
+ activity_id_t msg; /* Message de progression */
uint16_t i; /* Boucle de parcours */
result = true;
@@ -356,9 +358,18 @@ bool annotate_elf_program_header_table(GElfFormat *format)
e_phnum = ELF_HDR(format, *header, e_phnum);
+ msg = gtk_status_stack_add_activity(status, _("Writing annotations for all Elf program headers..."), e_phnum);
+
for (i = 0; i < e_phnum && result; i++)
+ {
result = annotate_elf_program_header(format, endian, &pos);
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
+ }
+
+ gtk_status_stack_remove_activity(status, msg);
+
return true;
}
diff --git a/plugins/readelf/program.h b/plugins/readelf/program.h
index b1f3a6d..1ff26b5 100644
--- a/plugins/readelf/program.h
+++ b/plugins/readelf/program.h
@@ -30,7 +30,7 @@
/* Charge tous les symboles liés aux en-têtes de programme ELF. */
-bool annotate_elf_program_header_table(GElfFormat *);
+bool annotate_elf_program_header_table(GElfFormat *, GtkStatusStack *);
diff --git a/plugins/readelf/reader.c b/plugins/readelf/reader.c
index 2d10540..875b568 100644
--- a/plugins/readelf/reader.c
+++ b/plugins/readelf/reader.c
@@ -42,6 +42,7 @@ DEFINE_CHRYSALIDE_ACTIVE_PLUGIN("readelf", "Displays information about ELF files
* Paramètres : plugin = greffon à manipuler. *
* action = type d'action attendue. *
* format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Etablit des symboles complémentaires dans un format ELF. *
* *
@@ -51,7 +52,7 @@ DEFINE_CHRYSALIDE_ACTIVE_PLUGIN("readelf", "Displays information about ELF files
* *
******************************************************************************/
-G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *plugin, PluginAction action, GBinFormat *format)
+G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *plugin, PluginAction action, GBinFormat *format, GtkStatusStack *status)
{
bool result; /* Bilan à retourner */
GElfFormat *elf_fmt; /* Version ELF */
@@ -66,9 +67,9 @@ G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *plugin, PluginAct
result = annotate_elf_header(elf_fmt);
- result &= annotate_elf_program_header_table(elf_fmt);
+ result &= annotate_elf_program_header_table(elf_fmt, status);
- result &= annotate_elf_section_header_table(elf_fmt);
+ result &= annotate_elf_section_header_table(elf_fmt, status);
hbf_exit:
diff --git a/plugins/readelf/reader.h b/plugins/readelf/reader.h
index 0080766..00f81d1 100644
--- a/plugins/readelf/reader.h
+++ b/plugins/readelf/reader.h
@@ -32,7 +32,7 @@
/* Etablit des symboles complémentaires dans un format ELF. */
-G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *, PluginAction, GBinFormat *);
+G_MODULE_EXPORT bool handle_binary_format(const GPluginModule *, PluginAction, GBinFormat *, GtkStatusStack *);
diff --git a/plugins/readelf/section.c b/plugins/readelf/section.c
index bae4b4c..f7aa727 100644
--- a/plugins/readelf/section.c
+++ b/plugins/readelf/section.c
@@ -399,6 +399,7 @@ static bool annotate_elf_section_header(GElfFormat *format, SourceEndian endian,
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Charge tous les symboles liés aux en-têtes de section ELF. *
* *
@@ -408,7 +409,7 @@ static bool annotate_elf_section_header(GElfFormat *format, SourceEndian endian,
* *
******************************************************************************/
-bool annotate_elf_section_header_table(GElfFormat *format)
+bool annotate_elf_section_header_table(GElfFormat *format, GtkStatusStack *status)
{
bool result; /* Bilan à retourner */
const elf_header *header; /* En-tête principale */
@@ -417,6 +418,7 @@ bool annotate_elf_section_header_table(GElfFormat *format)
off_t offset; /* Tête de lecture du binaire */
vmpa2t pos; /* Localisation des symboles */
uint16_t e_shnum; /* Nombre d'éléments 'Program' */
+ activity_id_t msg; /* Message de progression */
uint16_t i; /* Boucle de parcours */
result = true;
@@ -433,9 +435,18 @@ bool annotate_elf_section_header_table(GElfFormat *format)
e_shnum = ELF_HDR(format, *header, e_shnum);
+ msg = gtk_status_stack_add_activity(status, _("Writing annotations for all Elf section headers..."), e_shnum);
+
for (i = 0; i < e_shnum && result; i++)
+ {
result = annotate_elf_section_header(format, endian, &strings, &pos);
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
+ }
+
+ gtk_status_stack_remove_activity(status, msg);
+
return true;
}
diff --git a/plugins/readelf/section.h b/plugins/readelf/section.h
index ab0e50b..a40c5c5 100644
--- a/plugins/readelf/section.h
+++ b/plugins/readelf/section.h
@@ -30,7 +30,7 @@
/* Charge tous les symboles liés aux en-têtes de section ELF. */
-bool annotate_elf_section_header_table(GElfFormat *);
+bool annotate_elf_section_header_table(GElfFormat *, GtkStatusStack *);
diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c
index 3388861..582390a 100755
--- a/src/format/dex/dex.c
+++ b/src/format/dex/dex.c
@@ -265,16 +265,16 @@ GBinFormat *g_dex_format_new(GBinContent *content, GExeFormat *parent, GtkStatus
/* TODO : vérifier que les *_id ne se chevauchent pas */
- if (!load_all_dex_types(result))
+ if (!load_all_dex_types(result, status))
goto gdfn_error;
- if (!load_all_dex_fields(result))
+ if (!load_all_dex_fields(result, status))
goto gdfn_error;
- if (!load_all_dex_classes(result))
+ if (!load_all_dex_classes(result, status))
goto gdfn_error;
- if (!g_binary_format_complete_loading(base))
+ if (!g_binary_format_complete_loading(base, status))
goto gdfn_error;
return base;
diff --git a/src/format/dex/pool.c b/src/format/dex/pool.c
index 3842aa9..f624ff3 100644
--- a/src/format/dex/pool.c
+++ b/src/format/dex/pool.c
@@ -28,6 +28,9 @@
#include <string.h>
+#include <i18n.h>
+
+
#include "dex-int.h"
#include "../mangling/demangler.h"
#include "../mangling/dex/context.h"
@@ -122,6 +125,7 @@ const char *get_string_from_dex_pool(const GDexFormat *format, uint32_t index)
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+ status = barre de statut à tenir informée. *
* *
* Description : Charge en mémoire l'ensemble des types du format DEX. *
* *
@@ -131,9 +135,10 @@ const char *get_string_from_dex_pool(const GDexFormat *format, uint32_t index)
* *
******************************************************************************/
-bool load_all_dex_types(GDexFormat *format)
+bool load_all_dex_types(GDexFormat *format, GtkStatusStack *status)
{
bool result; /* Bilan à retourner */
+ activity_id_t msg; /* Message de progression */
uint32_t i; /* Boucle de parcours */
GDataType *type; /* Type récupéré */
@@ -141,6 +146,9 @@ bool load_all_dex_types(GDexFormat *format)
format->types = (GDataType **)calloc(format->header.type_ids_size, sizeof(GDataType *));
+ msg = gtk_status_stack_add_activity(status, _("Loading all types from the Dex pool..."),
+ format->header.type_ids_size);
+
for (i = 0; i < format->header.type_ids_size && result; i++)
{
type = get_type_from_dex_pool(format, i);
@@ -150,8 +158,12 @@ bool load_all_dex_types(GDexFormat *format)
else
result = false;
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
}
+ gtk_status_stack_remove_activity(status, msg);
+
return result;
}
@@ -223,6 +235,7 @@ GDataType *get_type_from_dex_pool(GDexFormat *format, uint32_t index)
/******************************************************************************
* *
* Paramètres : format = description de l'exécutable à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Charge en mémoire l'ensemble des champs du format DEX. *
* *
@@ -232,9 +245,10 @@ GDataType *get_type_from_dex_pool(GDexFormat *format, uint32_t index)
* *
******************************************************************************/
-bool load_all_dex_fields(GDexFormat *format)
+bool load_all_dex_fields(GDexFormat *format, GtkStatusStack *status)
{
bool result; /* Bilan à retourner */
+ activity_id_t msg; /* Message de progression */
uint32_t i; /* Boucle de parcours */
GBinVariable *field; /* Champ récupéré */
@@ -242,6 +256,9 @@ bool load_all_dex_fields(GDexFormat *format)
format->fields = (GBinVariable **)calloc(format->header.field_ids_size, sizeof(GBinVariable *));
+ msg = gtk_status_stack_add_activity(status, _("Loading all fields from the Dex pool..."),
+ format->header.field_ids_size);
+
for (i = 0; i < format->header.field_ids_size && result; i++)
{
field = get_field_from_dex_pool(format, i);
@@ -251,8 +268,12 @@ bool load_all_dex_fields(GDexFormat *format)
else
result = false;
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
}
+ gtk_status_stack_remove_activity(status, msg);
+
return result;
}
@@ -495,6 +516,7 @@ GDexMethod *get_method_from_dex_pool(GDexFormat *format, uint32_t index)
/******************************************************************************
* *
* Paramètres : format = représentation interne du format DEX à compléter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Charge toutes les classes listées dans le contenu binaire. *
* *
@@ -504,9 +526,10 @@ GDexMethod *get_method_from_dex_pool(GDexFormat *format, uint32_t index)
* *
******************************************************************************/
-bool load_all_dex_classes(GDexFormat *format)
+bool load_all_dex_classes(GDexFormat *format, GtkStatusStack *status)
{
bool result; /* Bilan à retourner */
+ activity_id_t msg; /* Message de progression */
uint32_t i; /* Boucle de parcours */
GDexClass *class; /* Classe récupérée */
@@ -514,6 +537,9 @@ bool load_all_dex_classes(GDexFormat *format)
format->classes = (GDexClass **)calloc(format->header.class_defs_size, sizeof(GDexClass *));
+ msg = gtk_status_stack_add_activity(status, _("Loading all classes from the Dex pool..."),
+ format->header.class_defs_size);
+
for (i = 0; i < format->header.class_defs_size && result; i++)
{
class = get_class_from_dex_pool(format, i);
@@ -523,8 +549,12 @@ bool load_all_dex_classes(GDexFormat *format)
else
result = false;
+ gtk_status_stack_update_activity_value(status, msg, 1);
+
}
+ gtk_status_stack_remove_activity(status, msg);
+
return result;
}
diff --git a/src/format/dex/pool.h b/src/format/dex/pool.h
index 8043153..4b804cc 100644
--- a/src/format/dex/pool.h
+++ b/src/format/dex/pool.h
@@ -43,13 +43,13 @@ const char *get_string_from_dex_pool(const GDexFormat *, uint32_t);
/* Charge en mémoire l'ensemble des types du format DEX. */
-bool load_all_dex_types(GDexFormat *);
+bool load_all_dex_types(GDexFormat *, GtkStatusStack *);
/* Extrait une représentation de type d'une table DEX. */
GDataType *get_type_from_dex_pool(GDexFormat *, uint32_t);
/* Charge en mémoire l'ensemble des champs du format DEX. */
-bool load_all_dex_fields(GDexFormat *);
+bool load_all_dex_fields(GDexFormat *, GtkStatusStack *);
/* Extrait une représentation de champ d'une table DEX. */
GBinVariable *get_field_from_dex_pool(GDexFormat *, uint32_t);
@@ -57,14 +57,11 @@ GBinVariable *get_field_from_dex_pool(GDexFormat *, uint32_t);
/* Extrait une représentation de routine d'une table DEX. */
GBinRoutine *get_prototype_from_dex_pool(GDexFormat *, uint32_t);
-/* Charge toutes les méthodes listées dans le contenu binaire. */
-bool load_all_dex_methods(GDexFormat *);
-
/* Extrait une représentation de méthode d'une table DEX. */
GDexMethod *get_method_from_dex_pool(GDexFormat *, uint32_t);
/* Charge toutes les classes listées dans le contenu binaire. */
-bool load_all_dex_classes(GDexFormat *);
+bool load_all_dex_classes(GDexFormat *, GtkStatusStack *);
/* Extrait une représentation de classe d'une table DEX. */
GDexClass *get_class_from_dex_pool(GDexFormat *, uint32_t);
diff --git a/src/format/elf/elf.c b/src/format/elf/elf.c
index d09b845..7ea9417 100644
--- a/src/format/elf/elf.c
+++ b/src/format/elf/elf.c
@@ -243,10 +243,13 @@ static void g_elf_format_finalize(GElfFormat *format)
GBinFormat *g_elf_format_new(GBinContent *content, GExeFormat *parent, GtkStatusStack *status)
{
GElfFormat *result; /* Structure à retourner */
+ GBinFormat *base; /* Version basique du format */
result = g_object_new(G_TYPE_ELF_FORMAT, NULL);
- g_binary_format_set_content(G_BIN_FORMAT(result), content);
+ base = G_BIN_FORMAT(result);
+
+ g_binary_format_set_content(base, content);
if (!read_elf_header(result, &result->header, &result->is_32b, &result->endian))
{
@@ -302,10 +305,10 @@ GBinFormat *g_elf_format_new(GBinContent *content, GExeFormat *parent, GtkStatus
}
- if (!g_binary_format_complete_loading(G_BIN_FORMAT(result)))
+ if (!g_binary_format_complete_loading(base, status))
goto gefn_error;
- return G_BIN_FORMAT(result);
+ return base;
gefn_error:
diff --git a/src/format/format-int.h b/src/format/format-int.h
index b19749d..9282b3c 100644
--- a/src/format/format-int.h
+++ b/src/format/format-int.h
@@ -84,7 +84,7 @@ struct _GBinFormatClass
/* Effectue les ultimes opérations de chargement d'un binaire. */
-bool g_binary_format_complete_loading(GBinFormat *);
+bool g_binary_format_complete_loading(GBinFormat *, GtkStatusStack *);
/* Définit le contenu binaire à analyser. */
void g_binary_format_set_content(GBinFormat *, GBinContent *);
diff --git a/src/format/format.c b/src/format/format.c
index ef8258f..5e5755c 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -107,6 +107,7 @@ static void g_binary_format_init(GBinFormat *format)
/******************************************************************************
* *
* Paramètres : format = instance à traiter. *
+* status = barre de statut à tenir informée. *
* *
* Description : Effectue les ultimes opérations de chargement d'un binaire. *
* *
@@ -116,9 +117,9 @@ static void g_binary_format_init(GBinFormat *format)
* *
******************************************************************************/
-bool g_binary_format_complete_loading(GBinFormat *format)
+bool g_binary_format_complete_loading(GBinFormat *format, GtkStatusStack *status)
{
- handle_binary_format(PGA_FORMAT_LOADER_LAST, format);
+ handle_binary_format(PGA_FORMAT_LOADER_LAST, format, status);
g_binary_format_delete_duplicated_symbols(format);
diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h
index 071dc6c..33e7001 100644
--- a/src/plugins/pglist.h
+++ b/src/plugins/pglist.h
@@ -61,12 +61,12 @@ const GPluginModule **get_all_plugins_for_action(PluginAction, size_t *);
while (0)
-/* DPS_FORMAT / PGA_FORMAT_MATCHER */
+/* DPS_FORMAT */
#define find_matching_format()
-#define handle_binary_format(a, f) \
- process_all_plugins_for(a, g_plugin_module_handle_binary_format, f)
+#define handle_binary_format(a, f, s) \
+ process_all_plugins_for(a, g_plugin_module_handle_binary_format, f, s)
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h
index f786c08..f644f05 100644
--- a/src/plugins/plugin-int.h
+++ b/src/plugins/plugin-int.h
@@ -49,7 +49,7 @@ typedef void (* pg_process_disassembly_fc) (const GPluginModule *, PluginAction,
//typedef bool (* pg_format_is_matching) (const GPluginModule *, GBinContent **);
/* Procède à une opération liée au format de fichier uniquement. */
-typedef bool (* pg_handle_format) (const GPluginModule *, PluginAction, GBinFormat *);
+typedef bool (* pg_handle_format) (const GPluginModule *, PluginAction, GBinFormat *, GtkStatusStack *);
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index c0e9fd1..d6dc891 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -488,6 +488,7 @@ void g_plugin_module_log_variadic_message(const GPluginModule *plugin, LogMessag
* Paramètres : plugin = greffon à manipuler. *
* action = type d'action attendue. *
* format = format de binaire à manipuler pendant l'opération. *
+* status = barre de statut à tenir informée. *
* *
* Description : Procède à une opération liée au format de fichier uniquement.*
* *
@@ -497,9 +498,9 @@ void g_plugin_module_log_variadic_message(const GPluginModule *plugin, LogMessag
* *
******************************************************************************/
-bool g_plugin_module_handle_binary_format(const GPluginModule *plugin, PluginAction action, GBinFormat *format)
+bool g_plugin_module_handle_binary_format(const GPluginModule *plugin, PluginAction action, GBinFormat *format, GtkStatusStack *status)
{
- return plugin->handle_format(plugin, action, format);
+ return plugin->handle_format(plugin, action, format, status);
}
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index b974ca8..33c4a2e 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -62,7 +62,7 @@ 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 *);
+bool g_plugin_module_handle_binary_format(const GPluginModule *, PluginAction, GBinFormat *, GtkStatusStack *);
/* Exécute une action pendant un désassemblage de binaire. */
void g_plugin_module_process_disassembly_event(const GPluginModule *, PluginAction, GLoadedBinary *);