diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-05-04 17:56:33 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-05-04 17:57:10 (GMT) |
commit | b92a5e56de9198c08956ce486cd12712d7034731 (patch) | |
tree | 4ee902ed116b9988dfd284186c725f1bb1d20f22 /plugins/dalvik/operands | |
parent | c9f7b4491b368f886b0852ba166cef969fd6d20f (diff) |
Created a GLib object for the Dex pool.
Diffstat (limited to 'plugins/dalvik/operands')
-rw-r--r-- | plugins/dalvik/operands/pool.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/dalvik/operands/pool.c b/plugins/dalvik/operands/pool.c index 8f6ccff..e9f1d60 100644 --- a/plugins/dalvik/operands/pool.c +++ b/plugins/dalvik/operands/pool.c @@ -262,6 +262,7 @@ static int g_dalvik_pool_operand_compare(const GDalvikPoolOperand *a, const GDal static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBufferLine *line) { + GDexPool *pool; /* Table de ressources */ const char *string; /* Chaîne de caractères #1 */ GDataType *type; /* Type à représenter */ size_t len; /* Taille du texte à créer */ @@ -270,6 +271,8 @@ static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBuff GBinVariable *field; /* Champ à représenter */ GDexMethod *method; /* Méthode à retrouver */ + pool = g_dex_format_get_pool(operand->format); + switch (operand->type) { case DPT_NONE: @@ -278,7 +281,7 @@ static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBuff case DPT_STRING: - string = get_string_from_dex_pool(operand->format, operand->index, NULL); + string = g_dex_pool_get_string(pool, operand->index, NULL); if (string != NULL) { @@ -308,7 +311,7 @@ static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBuff case DPT_TYPE: - type = get_type_from_dex_pool(operand->format, operand->index); + type = g_dex_pool_get_type_(pool, operand->index); if (type != NULL) { @@ -336,7 +339,7 @@ static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBuff case DPT_PROTO: - routine = get_prototype_from_dex_pool(operand->format, operand->index); + routine = g_dex_pool_get_prototype(pool, operand->index); if (routine != NULL) { @@ -362,7 +365,7 @@ static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBuff case DPT_FIELD: - field = get_field_from_dex_pool(operand->format, operand->index); + field = g_dex_pool_get_field(pool, operand->index); if (field != NULL) { @@ -390,7 +393,7 @@ static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBuff case DPT_METHOD: - method = get_method_from_dex_pool(operand->format, operand->index); + method = g_dex_pool_get_method(pool, operand->index); if (method != NULL) routine = g_dex_method_get_routine(method); @@ -424,6 +427,8 @@ static void g_dalvik_pool_operand_print(const GDalvikPoolOperand *operand, GBuff } + g_object_unref(G_OBJECT(pool)); + } @@ -628,6 +633,7 @@ static bool g_dalvik_pool_operand_serialize(const GDalvikPoolOperand *operand, G static bool g_dalvik_pool_operand_get_addr(const GDalvikPoolOperand *operand, const vmpa2t *src, GBinFormat *format, GArchProcessor *proc, vmpa2t *addr) { bool result; /* Bilan à retourner */ + GDexPool *pool; /* Table de ressources */ GDexMethod *method; /* Méthode ciblée ici */ GBinRoutine *routine; /* Routine liée à la méthode */ const mrange_t *range; /* Zone d'occupation */ @@ -636,7 +642,11 @@ static bool g_dalvik_pool_operand_get_addr(const GDalvikPoolOperand *operand, co if (operand->type == DPT_METHOD) { - method = get_method_from_dex_pool(G_DEX_FORMAT(format), operand->index); + pool = g_dex_format_get_pool(G_DEX_FORMAT(format)); + + method = g_dex_pool_get_method(pool, operand->index); + + g_object_unref(G_OBJECT(pool)); if (method != NULL) { |