summaryrefslogtreecommitdiff
path: root/plugins/dalvik
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-05-04 17:56:33 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-05-04 17:57:10 (GMT)
commitb92a5e56de9198c08956ce486cd12712d7034731 (patch)
tree4ee902ed116b9988dfd284186c725f1bb1d20f22 /plugins/dalvik
parentc9f7b4491b368f886b0852ba166cef969fd6d20f (diff)
Created a GLib object for the Dex pool.
Diffstat (limited to 'plugins/dalvik')
-rw-r--r--plugins/dalvik/link.c14
-rw-r--r--plugins/dalvik/operands/pool.c22
2 files changed, 28 insertions, 8 deletions
diff --git a/plugins/dalvik/link.c b/plugins/dalvik/link.c
index 6b100c9..4960917 100644
--- a/plugins/dalvik/link.c
+++ b/plugins/dalvik/link.c
@@ -81,6 +81,7 @@ void handle_links_for_dalvik_string(GArchInstruction *instr, GArchProcessor *pro
{
GArchOperand *op; /* Opérande numérique en place */
uint32_t index; /* Indice dans la table Dex */
+ GDexPool *pool; /* Table de ressources */
GBinSymbol *string; /* Emplacement de la chaîne */
const mrange_t *range; /* Zone d'occupation */
GArchInstruction *target; /* Ligne visée par la référence*/
@@ -99,7 +100,11 @@ void handle_links_for_dalvik_string(GArchInstruction *instr, GArchProcessor *pro
index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(op));
- string = get_string_symbol_from_dex_pool(G_DEX_FORMAT(format), index);
+ pool = g_dex_format_get_pool(G_DEX_FORMAT(format));
+
+ string = g_dex_pool_get_string_symbol(pool, index);
+
+ g_object_unref(G_OBJECT(pool));
if (string != NULL)
{
@@ -396,6 +401,7 @@ void handle_links_between_caller_and_callee(GArchInstruction *instr, GArchProces
{
GArchOperand *op; /* Opérande numérique en place */
uint32_t index; /* Indice dans la table Dex */
+ 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 */
@@ -415,7 +421,11 @@ void handle_links_between_caller_and_callee(GArchInstruction *instr, GArchProces
index = g_dalvik_pool_operand_get_index(G_DALVIK_POOL_OPERAND(op));
- method = get_method_from_dex_pool(G_DEX_FORMAT(format), index);
+ pool = g_dex_format_get_pool(G_DEX_FORMAT(format));
+
+ method = g_dex_pool_get_method(pool, index);
+
+ g_object_unref(G_OBJECT(pool));
if (method != NULL)
{
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)
{