summaryrefslogtreecommitdiff
path: root/plugins
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 /plugins
parentfe39a487b4db5564036a436bfcb7cf3561889fb5 (diff)
Displayed more details about the loading process in the status bar.
Diffstat (limited to 'plugins')
-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
12 files changed, 106 insertions, 28 deletions
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 *);