diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2015-12-28 23:27:12 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2015-12-28 23:27:12 (GMT) | 
| commit | b57e8ef5522dcbe126157fc2c50fcf879aa7d743 (patch) | |
| tree | 1ecfd9de39073fee3a2c1a4afa9ce5da574b26df /src/format/dex | |
| parent | 276b75e6e9ff99a930bd36045e55b1117bb29579 (diff) | |
Defined layers to register all kinds of binary portions.
Diffstat (limited to 'src/format/dex')
| -rw-r--r-- | src/format/dex/class.c | 8 | ||||
| -rw-r--r-- | src/format/dex/class.h | 2 | ||||
| -rwxr-xr-x | src/format/dex/dex.c | 16 | ||||
| -rw-r--r-- | src/format/dex/method.c | 6 | ||||
| -rw-r--r-- | src/format/dex/method.h | 2 | 
5 files changed, 21 insertions, 13 deletions
diff --git a/src/format/dex/class.c b/src/format/dex/class.c index 657461f..1dc3a40 100644 --- a/src/format/dex/class.c +++ b/src/format/dex/class.c @@ -309,7 +309,7 @@ GDexMethod *g_dex_class_get_method(const GDexClass *class, bool virtual, size_t  /******************************************************************************  *                                                                             *  *  Paramètres  : class = informations chargées à consulter.                   * -*                raw   = portion de binaire brut à raffiner.                  * +*                layer = couche de portions à raffiner.                       *  *                                                                             *  *  Description : Intègre la méthode en tant que portion de code.              *  *                                                                             * @@ -319,15 +319,15 @@ GDexMethod *g_dex_class_get_method(const GDexClass *class, bool virtual, size_t  *                                                                             *  ******************************************************************************/ -void g_dex_class_include_as_portion(const GDexClass *class, GBinPortion *raw) +void g_dex_class_include_as_portion(const GDexClass *class, GPortionLayer *layer)  {      size_t i;                               /* Boucle de parcours          */      for (i = 0; i < class->dmethods_count; i++) -        g_dex_method_include_as_portion(class->direct_methods[i], raw); +        g_dex_method_include_as_portion(class->direct_methods[i], layer);      for (i = 0; i < class->vmethods_count; i++) -        g_dex_method_include_as_portion(class->virtual_methods[i], raw); +        g_dex_method_include_as_portion(class->virtual_methods[i], layer);  } diff --git a/src/format/dex/class.h b/src/format/dex/class.h index 77fa6ba..fb7cada 100644 --- a/src/format/dex/class.h +++ b/src/format/dex/class.h @@ -64,7 +64,7 @@ size_t g_dex_class_count_methods(const GDexClass *, bool);  GDexMethod *g_dex_class_get_method(const GDexClass *, bool, size_t);  /* Intègre la méthode en tant que portion de code. */ -void g_dex_class_include_as_portion(const GDexClass *, GBinPortion *); +void g_dex_class_include_as_portion(const GDexClass *, GPortionLayer *);  /* Retrouve si possible la méthode associée à une adresse. */  GDexMethod *g_dex_class_find_method_by_address(const GDexClass *, vmpa_t); diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c index afd9db1..ed2565f 100755 --- a/src/format/dex/dex.c +++ b/src/format/dex/dex.c @@ -27,6 +27,9 @@  #include <string.h> +#include <i18n.h> + +  #include "dex-int.h"  #include "pool.h" @@ -55,7 +58,7 @@ static void g_dex_format_finalize(GDexFormat *);  static const char *g_dex_format_get_target_machine(const GDexFormat *);  /* Etend la définition des portions au sein d'un binaire. */ -static void g_dex_format_refine_portions(const GDexFormat *, GBinPortion *); +static void g_dex_format_refine_portions(const GDexFormat *, GPortionLayer *);  /* Fournit l'emplacement d'une section donnée. */  static bool g_dex_format_get_section_range_by_name(const GDexFormat *, const char *, mrange_t *); @@ -302,7 +305,7 @@ static const char *g_dex_format_get_target_machine(const GDexFormat *format)  /******************************************************************************  *                                                                             *  *  Paramètres  : format = informations chargées à consulter.                  * -*                raw    = portion de binaire brut à raffiner.                 * +*                main   = couche de portions principale à raffiner.           *  *                                                                             *  *  Description : Etend la définition des portions au sein d'un binaire.       *  *                                                                             * @@ -312,15 +315,20 @@ static const char *g_dex_format_get_target_machine(const GDexFormat *format)  *                                                                             *  ******************************************************************************/ -static void g_dex_format_refine_portions(const GDexFormat *format, GBinPortion *raw) +static void g_dex_format_refine_portions(const GDexFormat *format, GPortionLayer *main)  { +    GPortionLayer *layer;                   /* Couche à mettre en place    */      size_t max;                             /* Nombre d'itérations prévues */      size_t i;                               /* Boucle de parcours          */ +    layer = g_portion_layer_new(NO_LENGTH_YET, _("Code")); + +    g_portion_layer_attach_sub(main, layer); +      max = g_dex_format_count_classes(format);      for (i = 0; i < max; i++) -        g_dex_class_include_as_portion(format->classes[i], raw); +        g_dex_class_include_as_portion(format->classes[i], layer);  } diff --git a/src/format/dex/method.c b/src/format/dex/method.c index c68e9e1..9c911d1 100644 --- a/src/format/dex/method.c +++ b/src/format/dex/method.c @@ -294,7 +294,7 @@ GBinRoutine *g_dex_method_get_routine(const GDexMethod *method)  /******************************************************************************  *                                                                             *  *  Paramètres  : method = représentation interne du format DEX à consulter.   * -*                raw    = portion de binaire brut à raffiner.                 * +*                layer  = couche de portions à raffiner.                      *  *                                                                             *  *  Description : Intègre la méthode en tant que portion de code.              *  *                                                                             * @@ -304,7 +304,7 @@ GBinRoutine *g_dex_method_get_routine(const GDexMethod *method)  *                                                                             *  ******************************************************************************/ -void g_dex_method_include_as_portion(const GDexMethod *method, GBinPortion *raw) +void g_dex_method_include_as_portion(const GDexMethod *method, GPortionLayer *layer)  {      GBinPortion *new;                       /* Nouvelle portion définie    */      char *desc;                             /* Description d'une portion   */ @@ -327,7 +327,7 @@ void g_dex_method_include_as_portion(const GDexMethod *method, GBinPortion *raw)      g_binary_portion_set_rights(new, PAC_READ | PAC_EXEC); -    g_binary_portion_include(raw, new); +    g_portion_layer_include(layer, new);  } diff --git a/src/format/dex/method.h b/src/format/dex/method.h index dee33cb..4d29bac 100644 --- a/src/format/dex/method.h +++ b/src/format/dex/method.h @@ -82,7 +82,7 @@ const code_item *g_dex_method_get_dex_body(const GDexMethod *);  GBinRoutine *g_dex_method_get_routine(const GDexMethod *);  /* Intègre la méthode en tant que portion de code. */ -void g_dex_method_include_as_portion(const GDexMethod *, GBinPortion *); +void g_dex_method_include_as_portion(const GDexMethod *, GPortionLayer *);  /* Indique la position de la méthode au sein du binaire. */  off_t g_dex_method_get_offset(const GDexMethod *);  | 
