From 998f0697355ddfb17c5828c3ef236a5c795ee191 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Mon, 7 May 2018 17:29:54 +0200 Subject: Cleaned code. --- plugins/dex/class.c | 3 +++ plugins/dex/pool.c | 46 +++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/plugins/dex/class.c b/plugins/dex/class.c index ef3ed85..fded32c 100644 --- a/plugins/dex/class.c +++ b/plugins/dex/class.c @@ -673,8 +673,11 @@ void g_dex_class_include_as_portion(const GDexClass *class, GExeFormat *format) GDexMethod *g_dex_class_find_method_by_address(const GDexClass *class, vmpa_t addr) { GDexMethod *result; /* Trouvaille à retourner */ + +#if 0 size_t i; /* Boucle de parcours */ phys_t offset; /* Emplacement de méthode */ +#endif result = NULL; diff --git a/plugins/dex/pool.c b/plugins/dex/pool.c index bfc463a..1ed2c44 100644 --- a/plugins/dex/pool.c +++ b/plugins/dex/pool.c @@ -547,7 +547,6 @@ GBinRoutine *get_prototype_from_dex_pool(GDexFormat *format, uint32_t index) vmpa2t addr; /* Tête de lecture générique */ proto_id_item proto_id; /* Prototype de routine */ GDataType *type; /* Type de retour */ - const char *name; /* Description compressée */ type_list args; /* Liste des arguments */ uint32_t i; /* Boucle de parcours */ GBinVariable *arg; /* Argument reconstitué */ @@ -571,51 +570,52 @@ GBinRoutine *get_prototype_from_dex_pool(GDexFormat *format, uint32_t index) if (!read_dex_proto_id_item(format, &addr, &proto_id)) goto grfdp_error; + /** + * On choisit d'ignore le champ proto_id.shorty_idx : c'est un descripteur + * qui doit correspondre au retour et aux paramètres précisés avec les + * autres champs de la structure, donc l'information paraît redondante. + */ + /* Type de retour */ type = get_type_from_dex_pool(format, proto_id.return_type_idx); + if (type == NULL) goto grfdp_error; - /* Nom de la méthode */ + result = g_binary_routine_new(); - name = get_string_from_dex_pool(format, proto_id.shorty_idx, NULL); + g_binary_routine_set_return_type(result, type); - /* Liste des arguments */ + /* Liste des arguments, s'il y a */ pos = proto_id.parameters_off; - init_vmpa(&addr, pos, VMPA_NO_VIRTUAL); - result = g_binary_routine_new();/////////////////////// + if (pos > 0) + { + init_vmpa(&addr, pos, VMPA_NO_VIRTUAL); + + if (!read_dex_type_list(format, &addr, &args)) + goto grfdp_error; - if (read_dex_type_list(format, &addr, &args)) for (i = 0; i < args.size; i++) { type = get_type_from_dex_pool(format, args.list[i].type_idx); - if (type == NULL) continue; + if (type == NULL) goto grfdp_error; arg = g_binary_variable_new(type); - g_binary_routine_add_arg(result, arg);/////////////////////// + g_binary_routine_add_arg(result, arg); } - /* Mise en place finale */ - - ///////result = demangle_routine(G_TYPE_DEX_DEMANGLER, name); + } - //g_binary_routine_set_name(result, strdup("...")); + return result; -#if 1 - if (result != NULL)/////////////////////// - g_binary_routine_set_return_type(result, type); -#endif + grfdp_error: - /* if (result != NULL) - g_object_ref(G_OBJECT(result)); - */ + g_object_unref(G_OBJECT(result)); - grfdp_error: - - return result; + return NULL; } -- cgit v0.11.2-87-g4458