From 7adb4243ad629554e496de173977721a8a5d0110 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Mon, 17 May 2010 00:28:23 +0000
Subject: Given more details for each operand relative to one DEX pool.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@156 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog                       |  63 ++++++++
 configure.ac                    |   1 +
 plugins/Makefile.am             |   2 +-
 plugins/dexresolver/Makefile.am |  16 ++
 plugins/dexresolver/context.c   | 320 ++++++++++++++++++++++++++++++++++++++++
 plugins/dexresolver/context.h   |  57 +++++++
 plugins/dexresolver/operand.c   | 306 ++++++++++++++++++++++++++++++++++++++
 plugins/dexresolver/operand.h   |  70 +++++++++
 plugins/dexresolver/plugin.c    | 120 +++++++++++++++
 plugins/dexresolver/plugin.h    |  49 ++++++
 src/analysis/exporter.c         |   7 +
 src/analysis/variable.c         | 109 ++++++++++++++
 src/analysis/variable.h         |  18 +++
 src/arch/dalvik/operand.c       |  34 +++++
 src/arch/dalvik/operand.h       |   4 +
 src/arch/instruction.c          |   2 +-
 src/arch/instruction.h          |   2 +-
 src/format/dex/dex-int.c        |  57 +++++++
 src/format/dex/dex-int.h        |   4 +
 src/format/dex/dex_def.h        |  18 +++
 src/format/dex/pool.c           |  97 ++++++++++++
 src/format/dex/pool.h           |   8 +
 src/plugins/Makefile.am         |   2 +
 src/plugins/context-int.h       |  49 ++++++
 src/plugins/context.c           |  77 ++++++++++
 src/plugins/context.h           |  53 +++++++
 src/plugins/pglist.c            |   2 +-
 src/plugins/plugin-def.h        |  12 ++
 src/plugins/plugin-int.h        |   3 +-
 src/plugins/plugin.c            |  27 +++-
 src/plugins/plugin.h            |   2 +-
 31 files changed, 1583 insertions(+), 8 deletions(-)
 create mode 100644 plugins/dexresolver/Makefile.am
 create mode 100644 plugins/dexresolver/context.c
 create mode 100644 plugins/dexresolver/context.h
 create mode 100644 plugins/dexresolver/operand.c
 create mode 100644 plugins/dexresolver/operand.h
 create mode 100644 plugins/dexresolver/plugin.c
 create mode 100644 plugins/dexresolver/plugin.h
 create mode 100644 src/plugins/context-int.h
 create mode 100644 src/plugins/context.c
 create mode 100644 src/plugins/context.h

diff --git a/ChangeLog b/ChangeLog
index b97a1de..1796965 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,66 @@
+10-05-17  Cyrille Bagard <nocbos@gmail.com>
+
+	* configure.ac:
+	Add the new Makefiles from the 'plugins/dexresolver' directory
+	to AC_CONFIG_FILES.
+
+	* plugins/dexresolver/context.c:
+	* plugins/dexresolver/context.h:
+	* plugins/dexresolver/Makefile.am:
+	* plugins/dexresolver/operand.c:
+	* plugins/dexresolver/operand.h:
+	* plugins/dexresolver/plugin.c:
+	* plugins/dexresolver/plugin.h:
+	New entries: give more details for each operand relative to one DEX pool.
+
+	* plugins/Makefile.am:
+	Add dexresolver to SUBDIRS.
+
+	* src/analysis/exporter.c:
+	Define a color for the RTT_STRING attribute.
+
+	* src/analysis/variable.c:
+	* src/analysis/variable.h:
+	Define more properties for variables.
+
+	* src/arch/dalvik/operand.c:
+	* src/arch/dalvik/operand.h:
+	Provide methods to access internal fields of GDalvikPoolOperand instances.
+
+	* src/arch/instruction.c:
+	* src/arch/instruction.h:
+	Typo.
+
+	* src/format/dex/dex_def.h:
+	* src/format/dex/dex-int.c:
+	* src/format/dex/dex-int.h:
+	Define and read prototype and field identifiers. Set NO_INDEX.
+
+	* src/format/dex/pool.c:
+	* src/format/dex/pool.h:
+	Extract strings and fields from the DEX pool.
+
+	* src/plugins/context.c:
+	* src/plugins/context.h:
+	* src/plugins/context-int.h:
+	New entries: create contexts for each running instance of a plugin.
+
+	* src/plugins/Makefile.am:
+	Add the context-int.h and context.[ch] files to libplugins_la_SOURCES.
+
+	* src/plugins/pglist.c:
+	Enable plugins again.
+
+	* src/plugins/plugin.c:
+	* src/plugins/plugin-def.h:
+	Improve the way plugins are managed: introduce instances and type.
+
+	* src/plugins/plugin.h:
+	Typo.
+
+	* src/plugins/plugin-int.h:
+	Improve the way plugins are managed: introduce instances and type.
+
 10-05-13  Cyrille Bagard <nocbos@gmail.com>
 
 	* configure.ac:
diff --git a/configure.ac b/configure.ac
index bba9fdf..66c9e43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,6 +232,7 @@ AC_CONFIG_COMMANDS([marshal], [echo -e "VOID:UINT64,UINT64\nVOID:OBJECT\nVOID:OB
 AC_CONFIG_FILES([Makefile
                  pixmaps/Makefile
                  plugins/Makefile
+                 plugins/dexresolver/Makefile
                  plugins/govm/Makefile
                  plugins/pyoida/Makefile
                  plugins/pyoida/analysis/Makefile
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 63811b0..d3111b7 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -1,2 +1,2 @@
 
-SUBDIRS = pyoida stackvars theseus
+SUBDIRS = dexresolver pyoida stackvars theseus
diff --git a/plugins/dexresolver/Makefile.am b/plugins/dexresolver/Makefile.am
new file mode 100644
index 0000000..f290a99
--- /dev/null
+++ b/plugins/dexresolver/Makefile.am
@@ -0,0 +1,16 @@
+
+lib_LTLIBRARIES = libdexresolver.la
+
+libdexresolver_la_SOURCES =				\
+	context.h context.c					\
+	operand.h operand.c					\
+	plugin.h plugin.c
+
+libdexresolver_la_CFLAGS = $(AM_CFLAGS)
+
+
+INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) -I../../src
+
+AM_CPPFLAGS = 
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
diff --git a/plugins/dexresolver/context.c b/plugins/dexresolver/context.c
new file mode 100644
index 0000000..0b863e9
--- /dev/null
+++ b/plugins/dexresolver/context.c
@@ -0,0 +1,320 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * context.h - prototypes pour les instances d'actions du présent greffon
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "context.h"
+
+
+#include <analysis/line_code.h>
+#include <arch/dalvik/operand.h>
+#include <glibext/delayed-int.h>
+#include <plugins/context-int.h>
+
+
+#include "operand.h"
+
+
+
+/* ---------------------------- REMPLACEMENT D'OPERANDES ---------------------------- */
+
+
+#define G_TYPE_DEX_RESOLVER_WORK               g_dex_resolver_work_get_type()
+#define G_DEX_RESOLVER_WORK(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dex_resolver_work_get_type(), GDelayedDisassembly))
+#define G_IS_DEX_RESOLVER_WORK(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dex_resolver_work_get_type()))
+#define G_DEX_RESOLVER_WORK_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DEX_RESOLVER_WORK, GDelayedDisassemblyClass))
+#define G_IS_DEX_RESOLVER_WORK_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DEX_RESOLVER_WORK))
+#define G_DEX_RESOLVER_WORK_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DEX_RESOLVER_WORK, GDelayedDisassemblyClass))
+
+
+/* Instance du greffon pour OpenIDA (instance) */
+typedef struct _GDexResolverWork
+{
+    GDelayedWork parent;                    /* A laisser en premier        */
+
+    GOpenidaBinary *binary;                 /* Destinataire final          */
+
+} GDexResolverWork;
+
+
+/* Instance du greffon pour OpenIDA (classe) */
+typedef struct _GDexResolverWorkClass
+{
+    GDelayedWorkClass parent;               /* A laisser en premier        */
+
+} GDexResolverWorkClass;
+
+
+/* Indique le type défini pour les tâches de résolutions différées. */
+static GType g_dex_resolver_work_get_type(void);
+
+/* Initialise la classe des résolutions d'opérandes différées. */
+static void g_dex_resolver_work_class_init(GDexResolverWorkClass *);
+
+/* Initialise une tâche de résolution d'opérandes différée. */
+static void g_dex_resolver_work_init(GDexResolverWork *);
+
+/* Crée une tâche de résolution d'opérandes différée. */
+static GDexResolverWork *g_dex_resolver_work_new(GOpenidaBinary *);
+
+/* Assure la résolution d'opérandes en différé. */
+static void g_dex_resolver_work_process(GDexResolverWork *, GtkExtStatusBar *);
+
+
+
+/* -------------------------- TACHE DIFFEREE DANS LE TEMPS -------------------------- */
+/* -------------------------- TACHE DIFFEREE DANS LE TEMPS -------------------------- */
+
+
+
+/* Instance du greffon pour OpenIDA (instance) */
+struct _GDexResolverContext
+{
+    GPluginContext parent;                  /* A laisser en premier        */
+
+};
+
+
+/* Instance du greffon pour OpenIDA (classe) */
+struct _GDexResolverContextClass
+{
+    GPluginContextClass parent;             /* A laisser en premier        */
+
+};
+
+
+
+/* Initialise la classe des instances de greffon. */
+static void g_dex_resolver_context_class_init(GDexResolverContextClass *);
+
+/* Initialise une instance d'instance de greffon. */
+static void g_dex_resolver_context_init(GDexResolverContext *);
+
+
+
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/*                              REMPLACEMENT D'OPERANDES                              */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour les tâches de résolutions différées. */
+G_DEFINE_TYPE(GDexResolverWork, g_dex_resolver_work, G_TYPE_DELAYED_WORK);
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : klass = classe à initialiser.                                *
+*                                                                             *
+*  Description : Initialise la classe des résolutions d'opérandes différées.  *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dex_resolver_work_class_init(GDexResolverWorkClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : disass = instance à initialiser.                             *
+*                                                                             *
+*  Description : Initialise une tâche de résolution d'opérandes différée.     *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dex_resolver_work_init(GDexResolverWork *disass)
+{
+    G_DELAYED_WORK(disass)->run = (run_task_fc)g_dex_resolver_work_process;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : binary = binaire chargé en attente des résultats.            *
+*                                                                             *
+*  Description : Crée une tâche de résolution d'opérandes différée.           *
+*                                                                             *
+*  Retour      : Tâche créée.                                                 *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static GDexResolverWork *g_dex_resolver_work_new(GOpenidaBinary *binary)
+{
+    GDexResolverWork *result;               /* Tâche à retourner           */
+
+    result = g_object_new(G_TYPE_DEX_RESOLVER_WORK, NULL);
+
+    result->binary = binary;
+
+    return result;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : work      = analyse à mener.                                 *
+*                statusbar = barre de statut à tenir informée.                *
+*                                                                             *
+*  Description : Assure la résolution d'opérandes en différé.                 *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dex_resolver_work_process(GDexResolverWork *work, GtkExtStatusBar *statusbar)
+{
+    GDexFormat *format;                     /* Format du binaire utilisé   */
+    GRenderingLine *lines;                  /* Lignes désassemblées        */
+    GRenderingLine *iter;                   /* Boucle de parcours          */
+    GArchInstruction *instr;                /* Instruction à ausculter     */
+    size_t count;                           /* Quantité d'opérandes        */
+    size_t i;                               /* Boucle de parcours          */
+    const GArchOperand *op;                 /* Opérande à analyser         */
+    GArchOperand *new;                      /* Nouvel opérande à afficher  */
+
+    format = G_DEX_FORMAT(g_openida_binary_get_format(work->binary));
+
+    lines = g_openida_binary_get_lines(work->binary);
+
+    for (iter = lines;
+         iter != NULL;
+         iter = g_rendering_line_get_next_iter(lines, iter, NULL))
+    {
+        /* On ne traite que du code ici ! */
+        if (!G_IS_CODE_LINE(iter)) continue;
+
+        instr = g_code_line_get_instruction(G_CODE_LINE(iter));
+        count = g_arch_instruction_count_operands(instr);
+
+        for (i = 0; i < count; i++)
+        {
+            op = g_arch_instruction_get_operand(instr, i);
+
+            if (G_IS_DALVIK_POOL_OPERAND(op))
+            {
+                new = g_dalvik_hpool_operand_new(format, G_DALVIK_POOL_OPERAND(op));
+
+                if (new != NULL)
+                    g_arch_instruction_replace_operand(instr, new, op);
+
+            }
+
+        }
+
+    }
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/*                              REMPLACEMENT D'OPERANDES                              */
+/*                              REMPLACEMENT D'OPERANDES                              */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour une instance de greffon. */
+G_DEFINE_TYPE(GDexResolverContext, g_dex_resolver_context, G_TYPE_PLUGIN_CONTEXT);
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : klass = classe à initialiser.                                *
+*                                                                             *
+*  Description : Initialise la classe des instances de greffon.               *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dex_resolver_context_class_init(GDexResolverContextClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : context = instance à initialiser.                            *
+*                                                                             *
+*  Description : Initialise une instance d'instance de greffon.               *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dex_resolver_context_init(GDexResolverContext *context)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : binary = contenu binaire chargé à traiter.                   *
+*                                                                             *
+*  Description : Lance l'exécution d'une action du greffon.                   *
+*                                                                             *
+*  Retour      : Instance d'exécution du greffon.                             *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+GPluginContext *g_dex_resolver_context_new(GOpenidaBinary *binary)
+{
+    GPluginContext *result;                 /* Bilan d'exécution à renvoyer*/
+    GDexResolverWork *work;                 /* Tâche de parcours de lignes */
+
+    result = g_object_new(G_TYPE_DEX_RESOLVER_CONTEXT, NULL);
+
+    work = g_dex_resolver_work_new(binary);
+
+    g_signal_connect(work, "work-completed", G_CALLBACK(g_object_unref), NULL);
+
+    g_work_queue_schedule_work(get_work_queue(), G_DELAYED_WORK(work));
+
+    return result;
+
+}
diff --git a/plugins/dexresolver/context.h b/plugins/dexresolver/context.h
new file mode 100644
index 0000000..79e4204
--- /dev/null
+++ b/plugins/dexresolver/context.h
@@ -0,0 +1,57 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * context.h - prototypes pour les instances d'actions du présent greffon
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _PLUGINS_DEXRESOLVER_CONTEXT_H
+#define _PLUGINS_DEXRESOLVER_CONTEXT_H
+
+
+#include <analysis/binary.h>
+#include <plugins/context.h>
+
+
+
+/* Instance du greffon pour OpenIDA (instance) */
+typedef struct _GDexResolverContext GDexResolverContext;
+
+/* Instance du greffon pour OpenIDA (classe) */
+typedef struct _GDexResolverContextClass GDexResolverContextClass;
+
+
+#define G_TYPE_DEX_RESOLVER_CONTEXT                (g_dex_resolver_context_get_type())
+#define G_DEX_RESOLVER_CONTEXT(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_DEX_RESOLVER_CONTEXT, GDexResolverContext))
+#define G_IS_DEX_RESOLVER_CONTEXT(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_DEX_RESOLVER_CONTEXT))
+#define G_DEX_RESOLVER_CONTEXT_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_DEX_RESOLVER_CONTEXT, GDexResolverContextClass))
+#define G_IS_DEX_RESOLVER_CONTEXT_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_DEX_RESOLVER_CONTEXT))
+#define G_DEX_RESOLVER_CONTEXT_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_DEX_RESOLVER_CONTEXT, GDexResolverContextClass))
+
+
+/* Indique le type défini pour une instance de greffon. */
+GType g_dex_resolver_context_get_type(void);
+
+/* Lance l'exécution d'une action du greffon. */
+GPluginContext *g_dex_resolver_context_new(GOpenidaBinary *);
+
+
+
+#endif  /* _PLUGINS_DEXRESOLVER_CONTEXT_H */
diff --git a/plugins/dexresolver/operand.c b/plugins/dexresolver/operand.c
new file mode 100644
index 0000000..17adaf6
--- /dev/null
+++ b/plugins/dexresolver/operand.c
@@ -0,0 +1,306 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * operand.c - remplacement d'opérandes par d'autres plus explicites
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "operand.h"
+
+
+#include <string.h>
+
+
+#include <arch/operand-int.h>
+#include <format/dex/pool.h>
+
+
+
+/* ----------------- OPERANDES POINTANT VERS LA TABLE DE CONSTANTES ----------------- */
+
+
+/* Définition d'un opérande visant un élément de table de constantes Dalvik (instance) */
+struct _GDalvikHPoolOperand
+{
+    GArchOperand parent;                    /* Instance parente            */
+
+    const GDexFormat *format;               /* Format de binaire utilisé   */
+    const GDalvikPoolOperand *child;        /* Opérande encapsulé          */
+
+    union
+    {
+        GBinVariable *field;                /* Champ à représenter         */
+        GBinRoutine *method;                /* Méthode à représenter       */
+
+    } cache;
+
+};
+
+
+/* Définition d'un opérande visant un élément de table de constantes Dalvik (classe) */
+struct _GDalvikHPoolOperandClass
+{
+    GArchOperandClass parent;               /* Classe parente              */
+
+};
+
+
+/* Initialise la classe des opérandes de constante Dalvik. */
+static void g_dalvik_hpool_operand_class_init(GDalvikHPoolOperandClass *);
+
+/* Initialise une instance d'opérande de constante Dalvik. */
+static void g_dalvik_hpool_operand_init(GDalvikHPoolOperand *);
+
+/* Ajoute du texte simple à un fichier ouvert en écriture. */
+static void g_dalvik_hpool_operand_add_text(const GDalvikHPoolOperand *, GRenderingOptions *, MainRendering, FILE *);
+
+/* Ajoute à un tampon GLib le contenu de l'instance spécifiée. */
+static void g_dalvik_hpool_operand_to_buffer(/*const */GDalvikHPoolOperand *, GBufferLine *, GRenderingOptions *);
+
+
+
+
+
+
+
+
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/*                   OPERANDES POINTANT VERS LA TABLE DE CONSTANTES                   */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini par la GLib pour un un élément de table de constantes Dalvik. */
+G_DEFINE_TYPE(GDalvikHPoolOperand, g_dalvik_hpool_operand, G_TYPE_ARCH_OPERAND);
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : klass = classe à initialiser.                                *
+*                                                                             *
+*  Description : Initialise la classe des opérandes de constante Dalvik.      *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dalvik_hpool_operand_class_init(GDalvikHPoolOperandClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : operand = instance à initialiser.                            *
+*                                                                             *
+*  Description : Initialise une instance d'opérande de constante Dalvik.      *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dalvik_hpool_operand_init(GDalvikHPoolOperand *operand)
+{
+    GContentExporter *parent;               /* Instance parente            */
+
+    parent = G_CONTENT_EXPORTER(operand);
+
+    parent->add_text = (add_text_fc)g_dalvik_hpool_operand_add_text;
+    parent->export_buffer = (export_buffer_fc)g_dalvik_hpool_operand_to_buffer;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : format = représentation interne du format DEX à consulter.   *
+*                child  = instance existante à encapsuler.                    *
+*                                                                             *
+*  Description : Crée un opérande explicitant l'usage d'un élément constant.  *
+*                                                                             *
+*  Retour      : Opérande mis en place ou NULL si soucis.                     *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+GArchOperand *g_dalvik_hpool_operand_new(const GDexFormat *format, const GDalvikPoolOperand *child)
+{
+    GDalvikHPoolOperand *result;            /* Structure à retourner       */
+
+    if (g_dalvik_pool_operand_get_pool_type(child) == DPT_NONE)
+        return NULL;
+
+    result = g_object_new(G_TYPE_DALVIK_HPOOL_OPERAND, NULL);
+
+    result->format = format;
+    result->child = child;
+
+    return G_ARCH_OPERAND(result);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : operand   = opérande à transcrire.                           *
+*                options   = options de rendu.                                *
+*                rendering = support effectif final des lignes de code.       *
+*                stream    = flux ouvert en écriture.                         *
+*                                                                             *
+*  Description : Ajoute du texte simple à un fichier ouvert en écriture.      *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dalvik_hpool_operand_add_text(const GDalvikHPoolOperand *operand, GRenderingOptions *options, MainRendering rendering, FILE *stream)
+{
+    //g_content_exporter_add_text(G_CONTENT_EXPORTER(operand->reg), options, rendering, stream);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : operand = opérande à transcrire.                             *
+*                buffer  = espace où placer ledit contenu.                    *
+*                options = options de rendu.                                  *
+*                                                                             *
+*  Description : Ajoute à un tampon GLib le contenu de l'instance spécifiée.  *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dalvik_hpool_operand_to_buffer(/*const */GDalvikHPoolOperand *operand, GBufferLine *buffer, GRenderingOptions *options)
+{
+    GContentExporter *exporter;             /* Autre vision de l'opérande  */
+    uint32_t index;                         /* Indice de l'élément visé    */
+    const char *string;                     /* Chaîne à afficher           */
+    GOpenidaType *type;                     /* Type quelconque             */
+    char *tmp;                              /* Chaîne à afficher & libérer */
+
+    exporter = G_CONTENT_EXPORTER(operand);
+
+    index = g_dalvik_pool_operand_get_index(operand->child);
+
+    switch (g_dalvik_pool_operand_get_pool_type(operand->child))
+    {
+        case DPT_STRING:
+
+            string = get_string_from_dex_pool(operand->format, index);
+
+            if (string == NULL)
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      "<bad_string_index>", 18, RTT_STRING);
+            else
+            {
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      "\"", 1, RTT_STRING);
+
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      string, strlen(string), RTT_STRING);
+
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      "\"", 1, RTT_STRING);
+
+            }
+
+            break;
+
+        case DPT_FIELD:
+
+            if (operand->cache.field == NULL)
+                operand->cache.field = get_field_from_dex_pool(operand->format, index);
+
+            if (operand->cache.field == NULL)
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      "<bad_field_index>", 17, RTT_VAR_NAME);
+
+            else
+            {
+                type = g_binary_variable_get_vtype(operand->cache.field);
+                tmp = g_openida_type_to_string(type);
+
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      tmp, strlen(tmp), RTT_VAR_NAME);
+
+                free(tmp);
+
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      "->", 2, RTT_LTGT);
+
+                string = g_binary_variable_get_name(operand->cache.field);
+
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      string, strlen(string), RTT_VAR_NAME);
+
+            }
+
+            break;
+
+        case DPT_METHOD:
+
+            if (operand->cache.method == NULL)
+                operand->cache.method = get_routine_from_dex_pool(operand->format, index);
+
+            if (operand->cache.method == NULL)
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      "<bad_method_index>", 18, RTT_VAR_NAME);
+
+            else
+            {
+                tmp = g_binary_routine_to_string(operand->cache.method);
+
+                g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                      tmp, strlen(tmp), RTT_VAR_NAME);
+
+                free(tmp);
+
+            }
+
+            break;
+
+        default:
+            g_content_exporter_insert_into_buffer(exporter, buffer, BLC_ASSEMBLY,
+                                                  "<-?->", 5, RTT_SECTION);
+            break;
+
+    }
+
+
+
+
+}
+
+
+
+
diff --git a/plugins/dexresolver/operand.h b/plugins/dexresolver/operand.h
new file mode 100644
index 0000000..f5e9ef9
--- /dev/null
+++ b/plugins/dexresolver/operand.h
@@ -0,0 +1,70 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * operand.h - prototypes pour le remplacement d'opérandes par d'autres plus explicites
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_DEXRESOLVER_OPERAND_H
+#define _PLUGINS_DEXRESOLVER_OPERAND_H
+
+
+#include <glib-object.h>
+
+
+#include <arch/dalvik/operand.h>
+#include <format/dex/dex.h>
+
+
+
+/* ----------------- OPERANDES POINTANT VERS LA TABLE DE CONSTANTES ----------------- */
+
+
+
+#define G_TYPE_DALVIK_HPOOL_OPERAND                  g_dalvik_hpool_operand_get_type()
+#define G_DALVIK_HPOOL_OPERAND(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), g_dalvik_hpool_operand_get_type(), GDalvikHpoolOperand))
+#define G_IS_DALVIK_HPOOL_OPERAND(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_dalvik_hpool_operand_get_type()))
+#define G_DALVIK_HPOOL_OPERAND_GET_IFACE(inst)       (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_dalvik_hpool_operand_get_type(), GDalvikHpoolOperandIface))
+
+
+/* Définition d'un opérande visant un élément de table de constantes Dalvik (instance) */
+typedef struct _GDalvikHPoolOperand GDalvikHPoolOperand;
+
+/* Définition d'un opérande visant un élément de table de constantes Dalvik (classe) */
+typedef struct _GDalvikHPoolOperandClass GDalvikHPoolOperandClass;
+
+
+/* Indique le type défini par la GLib pour un un élément de table de constantes Dalvik. */
+GType g_dalvik_hpool_operand_get_type(void);
+
+/* Crée un opérande explicitant l'usage d'un élément constant. */
+GArchOperand *g_dalvik_hpool_operand_new(const GDexFormat *, const GDalvikPoolOperand *);
+
+
+
+
+
+
+
+
+
+
+
+
+#endif  /* _PLUGINS_DEXRESOLVER_OPERAND_H */
diff --git a/plugins/dexresolver/plugin.c b/plugins/dexresolver/plugin.c
new file mode 100644
index 0000000..356f7cf
--- /dev/null
+++ b/plugins/dexresolver/plugin.c
@@ -0,0 +1,120 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * plugin.c - résolution des références avec le format DEX
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "plugin.h"
+
+
+#include "context.h"
+
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : ref = espace de référencement global.                        *
+*                                                                             *
+*  Description : Initialise le greffon pour les bornes de routine.            *
+*                                                                             *
+*  Retour      : true.                                                        *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+G_MODULE_EXPORT bool init_plugin(GObject *ref)
+{
+    return true;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : -                                                            *
+*                                                                             *
+*  Description : Fournit une indication sur le(s) type(s) du greffon présent. *
+*                                                                             *
+*  Retour      : Description d'un greffon.                                    *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+G_MODULE_EXPORT PluginType get_plugin_type(void)
+{
+    return PGT_BINARY;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : -                                                            *
+*                                                                             *
+*  Description : Fournit une indication sur le type d'opération(s) menée(s).  *
+*                                                                             *
+*  Retour      : Description d'une action.                                    *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+G_MODULE_EXPORT PluginAction get_plugin_action(void)
+{
+    return PGA_CODE_PROCESS;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : binary = représentation binaire à traiter.                   *
+*                action = action attendue.                                    *
+*                                                                             *
+*  Description : Exécute une action définie sur un binaire chargé.            *
+*                                                                             *
+*  Retour      : true si une action a été menée, false sinon.                 *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *binary, PluginAction action)
+{
+    bool result;                            /* Bilan à retourner           */
+
+
+
+
+    GPluginContext *context;
+
+
+    context = g_dex_resolver_context_new(binary);
+
+    printf("Run it !!!\n");
+
+    result = true;
+
+
+    return result;
+
+}
diff --git a/plugins/dexresolver/plugin.h b/plugins/dexresolver/plugin.h
new file mode 100644
index 0000000..85da278
--- /dev/null
+++ b/plugins/dexresolver/plugin.h
@@ -0,0 +1,49 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * plugin.h - prototypes pour la résolution des références avec le format DEX
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _PLUGINS_DEXRESOLVER_PLUGIN_H
+#define _PLUGINS_DEXRESOLVER_PLUGIN_H
+
+
+#include <gmodule.h>
+
+
+#include <plugins/plugin-def.h>
+
+
+
+/* Initialise le greffon pour les bornes de routine. */
+G_MODULE_EXPORT bool init_plugin(GObject *);
+
+/* Fournit une indication sur le(s) type(s) du greffon présent. */
+G_MODULE_EXPORT PluginType get_plugin_type(void);
+
+/* Fournit une indication sur le type d'opération(s) menée(s). */
+G_MODULE_EXPORT PluginAction get_plugin_action(void);
+
+/* Exécute une action définie sur un binaire chargé. */
+G_MODULE_EXPORT bool execute_action_on_binary(GOpenidaBinary *, PluginAction);
+
+
+
+#endif  /* _PLUGINS_DEXRESOLVER_PLUGIN_H */
diff --git a/src/analysis/exporter.c b/src/analysis/exporter.c
index edff9d8..676b101 100644
--- a/src/analysis/exporter.c
+++ b/src/analysis/exporter.c
@@ -148,8 +148,15 @@ static void g_content_exporter_class_init(GContentExporterClass *klass)
 
     klass->attribs[RTT_SEGMENT] = pango_attr_list_new();
 
+    /* RTT_STRING */
+
     klass->attribs[RTT_STRING] = pango_attr_list_new();
 
+    attrib = pango_attr_foreground_new(52224, 32256, 0);
+    pango_attr_list_insert(klass->attribs[RTT_STRING], attrib);
+
+    /* RTT_VAR_NAME */
+
     klass->attribs[RTT_VAR_NAME] = pango_attr_list_new();
 
 }
diff --git a/src/analysis/variable.c b/src/analysis/variable.c
index e24f7e1..87df60e 100644
--- a/src/analysis/variable.c
+++ b/src/analysis/variable.c
@@ -24,6 +24,9 @@
 #include "variable.h"
 
 
+#include <string.h>
+
+
 #include "../common/extstr.h"
 
 
@@ -39,6 +42,8 @@ struct _GBinVariable
     GOpenidaType *type;                     /* Type de la variable         */
     char *name;                             /* Désignation humaine         */
 
+    GOpenidaType *owner;                    /* Zone d'appartenance         */
+
 };
 
 /* Variable typée (classe) */
@@ -128,6 +133,110 @@ GBinVariable *g_binary_variable_new(GOpenidaType *type)
 }
 
 
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : var = variable à consulter.                                  *
+*                                                                             *
+*  Description : Fournit le type d'une variable donnée.                       *
+*                                                                             *
+*  Retour      : Type de la variable.                                         *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+GOpenidaType *g_binary_variable_get_vtype(const GBinVariable *var)
+{
+    return var->type;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : var = variable à consulter.                                  *
+*                                                                             *
+*  Description : Fournit le nom d'une variable donnée.                        *
+*                                                                             *
+*  Retour      : Nom de la variable ou NULL si non précisé.                   *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+const char *g_binary_variable_get_name(const GBinVariable *var)
+{
+    return var->name;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : var  = variable à consulter.                                 *
+*                name = désignation à associer à la variable, voire NULL.     *
+*                                                                             *
+*  Description : Définit le nom d'une variable donnée.                        *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+void g_binary_variable_set_name(GBinVariable *var, const char *name)
+{
+    if (var->name != NULL)
+        free(var->name);
+
+    if (name == NULL) var->name = NULL;
+    else var->name = strdup(name);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : var = variable à consulter.                                  *
+*                                                                             *
+*  Description : Fournit la zone d'appartenance d'une variable donnée.        *
+*                                                                             *
+*  Retour      : Zone d'appartenance de la variable ou NULL.                  *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+GOpenidaType *g_binary_variable_get_owner(const GBinVariable *var)
+{
+    return var->owner;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : var   = variable à consulter.                                *
+*                owner = type identifiant la zone d'appartenance.             *
+*                                                                             *
+*  Description : Définit la zone d'appartenance d'une variable donnée.        *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+void g_binary_variable_set_owner(GBinVariable *var, GOpenidaType *owner)
+{
+    var->owner = owner;
+
+}
+
+
+
+
+
 
 
 
diff --git a/src/analysis/variable.h b/src/analysis/variable.h
index ab5a037..88e2b91 100644
--- a/src/analysis/variable.h
+++ b/src/analysis/variable.h
@@ -57,8 +57,26 @@ GType g_binary_variable_get_type(void);
 /* Crée une représentation de variable de type donné. */
 GBinVariable *g_binary_variable_new(GOpenidaType *);
 
+/* Fournit le type d'une variable donnée. */
+GOpenidaType *g_binary_variable_get_vtype(const GBinVariable *);
 
+/* Fournit le nom d'une variable donnée. */
+const char *g_binary_variable_get_name(const GBinVariable *);
 
+/* Définit le nom d'une variable donnée. */
+void g_binary_variable_set_name(GBinVariable *, const char *);
+
+/* Fournit la zone d'appartenance d'une variable donnée. */
+GOpenidaType *g_binary_variable_get_owner(const GBinVariable *);
+
+/* Définit la zone d'appartenance d'une variable donnée. */
+void g_binary_variable_set_owner(GBinVariable *, GOpenidaType *);
+
+
+
+
+
+/* TODO : remme */
 
 /* Décrit la variable donnée sous forme de caractères. */
 char *g_binary_variable_to_string(const GBinVariable *);
diff --git a/src/arch/dalvik/operand.c b/src/arch/dalvik/operand.c
index cc36cb5..7b58b1d 100644
--- a/src/arch/dalvik/operand.c
+++ b/src/arch/dalvik/operand.c
@@ -788,8 +788,42 @@ static void g_dalvik_pool_operand_to_buffer(const GDalvikPoolOperand *operand, G
 }
 
 
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : operand = opérande à consulter.                              *
+*                                                                             *
+*  Description : Indique la nature de la table de constantes visée ici.       *
+*                                                                             *
+*  Retour      : Type de table constantes visée.                              *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+DalvikPoolType g_dalvik_pool_operand_get_pool_type(const GDalvikPoolOperand *operand)
+{
+    return operand->type;
+
+}
 
 
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : operand = opérande à consulter.                              *
+*                                                                             *
+*  Description : Indique l'indice de l'élément dans la table de constantes.   *
+*                                                                             *
+*  Retour      : Indice de l'élément visé dans la table de constantes.        *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+uint32_t g_dalvik_pool_operand_get_index(const GDalvikPoolOperand *operand)
+{
+    return operand->index;
+
+}
 
 
 
diff --git a/src/arch/dalvik/operand.h b/src/arch/dalvik/operand.h
index da14aa3..4045c5f 100644
--- a/src/arch/dalvik/operand.h
+++ b/src/arch/dalvik/operand.h
@@ -138,7 +138,11 @@ GType g_dalvik_pool_operand_get_type(void);
 /* Crée un opérande visant un élément constant Dalvik. */
 GArchOperand *g_dalvik_pool_operand_new(DalvikPoolType, const bin_t *, off_t *, off_t, MemoryDataSize, SourceEndian);
 
+/* Indique la nature de la table de constantes visée ici. */
+DalvikPoolType g_dalvik_pool_operand_get_pool_type(const GDalvikPoolOperand *);
 
+/* Indique l'indice de l'élément dans la table de constantes. */
+uint32_t g_dalvik_pool_operand_get_index(const GDalvikPoolOperand *);
 
 
 
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index 14b0038..3bbd15c 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -322,7 +322,7 @@ const GArchOperand *g_arch_instruction_get_operand(GArchInstruction *instr, size
 *                new   = nouvelle opérande à attacher.                        *
 *                old   = ancienne opérande à détacher.                        *
 *                                                                             *
-*  Description : Replace un opérande d'une instruction par un autre.          *
+*  Description : Remplace un opérande d'une instruction par un autre.         *
 *                                                                             *
 *  Retour      : -                                                            *
 *                                                                             *
diff --git a/src/arch/instruction.h b/src/arch/instruction.h
index 0c51b93..2314a56 100644
--- a/src/arch/instruction.h
+++ b/src/arch/instruction.h
@@ -79,7 +79,7 @@ size_t g_arch_instruction_count_operands(const GArchInstruction *);
 /* Fournit un opérande donné d'une instruction. */
 const GArchOperand *g_arch_instruction_get_operand(GArchInstruction *, size_t);
 
-/* Replace un opérande d'une instruction par un autre. */
+/* Remplace un opérande d'une instruction par un autre. */
 void g_arch_instruction_replace_operand(GArchInstruction *, GArchOperand *, const GArchOperand *);
 
 /* Détache un opérande liée d'une instruction. */
diff --git a/src/format/dex/dex-int.c b/src/format/dex/dex-int.c
index be1c211..025429f 100644
--- a/src/format/dex/dex-int.c
+++ b/src/format/dex/dex-int.c
@@ -134,15 +134,72 @@ bool read_dex_type_id_item(const GDexFormat *format, off_t *pos, type_id_item *i
 }
 
 
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : format   = informations chargées à consulter.                *
+*                pos      = position de début de lecture. [OUT]               *
+*                proto_id = structure lue à retourner. [OUT]                  *
+*                                                                             *
+*  Description : Procède à la lecture d'une description de prototype.         *
+*                                                                             *
+*  Retour      : Bilan de l'opération.                                        *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
 
+bool read_dex_proto_id_item(const GDexFormat *format, off_t *pos, proto_id_item *proto_id)
+{
+    bool result;                            /* Bilan à retourner           */
+    const bin_t *content;                   /* Contenu binaire à lire      */
+    off_t length;                           /* Taille totale du contenu    */
 
+    result = true;
 
+    content = G_BIN_FORMAT(format)->content;
+    length = G_BIN_FORMAT(format)->length;
 
+    result &= read_u32(&proto_id->shorty_idx, content, pos, length, SRE_LITTLE);
+    result &= read_u32(&proto_id->return_type_idx, content, pos, length, SRE_LITTLE);
+    result &= read_u32(&proto_id->parameters_off, content, pos, length, SRE_LITTLE);
 
+    return result;
 
+}
 
 
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : format   = informations chargées à consulter.                *
+*                pos      = position de début de lecture. [OUT]               *
+*                field_id = structure lue à retourner. [OUT]                  *
+*                                                                             *
+*  Description : Procède à la lecture d'une description de champ.             *
+*                                                                             *
+*  Retour      : Bilan de l'opération.                                        *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+bool read_dex_field_id_item(const GDexFormat *format, off_t *pos, field_id_item *field_id)
+{
+    bool result;                            /* Bilan à retourner           */
+    const bin_t *content;                   /* Contenu binaire à lire      */
+    off_t length;                           /* Taille totale du contenu    */
+
+    result = true;
 
+    content = G_BIN_FORMAT(format)->content;
+    length = G_BIN_FORMAT(format)->length;
+
+    result &= read_u16(&field_id->class_idx, content, pos, length, SRE_LITTLE);
+    result &= read_u16(&field_id->type_idx, content, pos, length, SRE_LITTLE);
+    result &= read_u32(&field_id->name_idx, content, pos, length, SRE_LITTLE);
+
+    return result;
+
+}
 
 
 /******************************************************************************
diff --git a/src/format/dex/dex-int.h b/src/format/dex/dex-int.h
index e34dbd3..2e3cc00 100755
--- a/src/format/dex/dex-int.h
+++ b/src/format/dex/dex-int.h
@@ -71,7 +71,11 @@ bool read_dex_string_data_item(const GDexFormat *, off_t *, string_data_item *);
 /* Procède à la lecture d'un identifiant de type DEX. */
 bool read_dex_type_id_item(const GDexFormat *, off_t *, type_id_item *);
 
+/* Procède à la lecture d'une description de prototype. */
+bool read_dex_proto_id_item(const GDexFormat *, off_t *, proto_id_item *);
 
+/* Procède à la lecture d'une description de champ. */
+bool read_dex_field_id_item(const GDexFormat *, off_t *, field_id_item *);
 
 /* Procède à la lecture d'une description de méthode. */
 bool read_dex_method_id_item(const GDexFormat *, off_t *, method_id_item *);
diff --git a/src/format/dex/dex_def.h b/src/format/dex/dex_def.h
index 9387a90..9faf050 100755
--- a/src/format/dex/dex_def.h
+++ b/src/format/dex/dex_def.h
@@ -54,8 +54,23 @@ typedef struct _type_id_item
 
 } type_id_item;
 
+/* Description d'un prototype */
+typedef struct _proto_id_item
+{
+    uint32_t shorty_idx;                    /* Description version courte  */
+    uint32_t return_type_idx;               /* Type de retour              */
+    uint32_t parameters_off;                /* Position des arguments      */
 
+} proto_id_item;
 
+/* Description d'un champ */
+typedef struct _field_id_item
+{
+    uint16_t class_idx;                     /* Classe d'appartenance       */
+    uint16_t type_idx;                      /* Type du champ               */
+    uint32_t name_idx;                      /* Nom du champ                */
+
+} field_id_item;
 
 /* Description d'une méthode */
 typedef struct _method_id_item
@@ -151,6 +166,9 @@ typedef struct _code_item
 #define ENDIAN_CONSTANT             0x12345678
 #define REVERSE_ENDIAN_CONSTANT     0x78563412
 
+/* Indice non valide */
+#define NO_INDEX                0xffffffff
+
 
 /* En-tête de tout programe Dex */
 typedef struct _dex_header
diff --git a/src/format/dex/pool.c b/src/format/dex/pool.c
index 0a8bed3..dbcee52 100644
--- a/src/format/dex/pool.c
+++ b/src/format/dex/pool.c
@@ -34,6 +34,45 @@
 *  Paramètres  : format = représentation interne du format DEX à consulter.   *
 *                index  = index du type recherchée.                           *
 *                                                                             *
+*  Description : Extrait une chaîne de caractères d'une table DEX.            *
+*                                                                             *
+*  Retour      : Chaîne de caractères trouvées ou NULL en cas d'erreur.       *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+const char *get_string_from_dex_pool(const GDexFormat *format, uint32_t index)
+{
+    off_t pos;                              /* Tête de lecture             */
+    string_id_item str_id;                  /* Identifiant de chaîne       */
+    string_data_item str_data;              /* Description de chaîne       */
+
+    pos = format->header.string_ids_off + index * sizeof(string_id_item);
+
+    if (!read_dex_string_id_item(format, &pos, &str_id))
+        return NULL;
+
+    pos = str_id.string_data_off;
+
+    if (!read_dex_string_data_item(format, &pos, &str_data))
+        return NULL;
+
+    return (const char *)str_data.data;
+
+}
+
+
+
+
+
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : format = représentation interne du format DEX à consulter.   *
+*                index  = index du type recherchée.                           *
+*                                                                             *
 *  Description : Extrait une représentation de type d'une table DEX.          *
 *                                                                             *
 *  Retour      : Composant GLib créé.                                         *
@@ -119,6 +158,64 @@ GOpenidaType *get_class_from_dex_pool(const GDexFormat *format, uint16_t index)
 
 
 
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : format = représentation interne du format DEX à consulter.   *
+*                index  = index du champ recherché.                           *
+*                                                                             *
+*  Description : Extrait une représentation de champ d'une table DEX.         *
+*                                                                             *
+*  Retour      : Composant GLib créé.                                         *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+GBinVariable *get_field_from_dex_pool(const GDexFormat *format, uint32_t index)
+{
+    GBinVariable *result;                   /* Instance à retourner        */
+    off_t pos;                              /* Tête de lecture             */
+    field_id_item field_id;                 /* Description du champ        */
+    GOpenidaType *type;                     /* Type du champ               */
+    const char *name;                       /* Désignation humaine         */
+    GOpenidaType *owner;                    /* Propriétaire du champ       */
+
+    pos = format->header.field_ids_off + index * sizeof(field_id_item);
+
+    if (!read_dex_field_id_item(format, &pos, &field_id))
+        return NULL;
+
+    type = get_type_from_dex_pool(format, field_id.type_idx);
+
+    name = get_string_from_dex_pool(format, field_id.name_idx);
+    if (name == NULL) goto bad_name;
+  
+    result = g_binary_variable_new(type);
+    g_binary_variable_set_name(result, name);
+
+    if (field_id.class_idx != NO_INDEX)
+    {
+        owner = get_type_from_dex_pool(format, field_id.class_idx);
+        if (owner == NULL) goto bad_owner;
+
+        g_binary_variable_set_owner(result, owner);
+
+    }
+
+    return result;
+
+ bad_owner:
+
+    g_object_ref(G_OBJECT(type));
+    g_object_unref(G_OBJECT(result));
+
+ bad_name:
+
+    g_object_unref(G_OBJECT(type));
+
+    return NULL;
+
+}
 
 
 /******************************************************************************
diff --git a/src/format/dex/pool.h b/src/format/dex/pool.h
index a41a1da..263a807 100644
--- a/src/format/dex/pool.h
+++ b/src/format/dex/pool.h
@@ -31,6 +31,9 @@
 
 
 
+/* Extrait une chaîne de caractères d'une table DEX. */
+const char *get_string_from_dex_pool(const GDexFormat *, uint32_t);
+
 /* Extrait une représentation de type d'une table DEX. */
 GOpenidaType *get_type_from_dex_pool(const GDexFormat *, uint16_t);
 
@@ -40,6 +43,11 @@ GOpenidaType *get_class_from_dex_pool(const GDexFormat *, uint16_t);
 
 
 
+
+
+/* Extrait une représentation de champ d'une table DEX. */
+GBinVariable *get_field_from_dex_pool(const GDexFormat *, uint32_t);
+
 /* Extrait une représentation de routine d'une table DEX. */
 GBinRoutine *get_routine_from_dex_pool(const GDexFormat *, uleb128_t);
 
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 9a76f74..4e4a312 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -2,6 +2,8 @@
 lib_LTLIBRARIES = libplugins.la
 
 libplugins_la_SOURCES =					\
+	context-int.h						\
+	context.h context.c					\
 	pglist.h pglist.c					\
 	plugin-def.h						\
 	plugin-int.h						\
diff --git a/src/plugins/context-int.h b/src/plugins/context-int.h
new file mode 100644
index 0000000..fc03df8
--- /dev/null
+++ b/src/plugins/context-int.h
@@ -0,0 +1,49 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * context-int.h - prototypes pour les structures internes des instances de greffon
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _FORMAT_PLUGINS_CONTEXT_INT_H
+#define _FORMAT_PLUGINS_CONTEXT_INT_H
+
+
+#include <glib-object.h>
+
+
+
+/* Instance de greffon pour OpenIDA (instance) */
+struct _GPluginContext
+{
+    GObject parent;                         /* A laisser en premier        */
+
+};
+
+
+/* Instance de greffon pour OpenIDA (classe) */
+struct _GPluginContextClass
+{
+    GObjectClass parent;                    /* A laisser en premier        */
+
+};
+
+
+
+#endif  /* _FORMAT_PLUGINS_CONTEXT_INT_H */
diff --git a/src/plugins/context.c b/src/plugins/context.c
new file mode 100644
index 0000000..06fd17e
--- /dev/null
+++ b/src/plugins/context.c
@@ -0,0 +1,77 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * context.c - instances d'actions d'un greffon donné
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "context.h"
+
+
+#include "context-int.h"
+
+
+
+/* Initialise la classe des instances de greffon. */
+static void g_plugin_context_class_init(GPluginContextClass *);
+
+/* Initialise une instance d'instance de greffon. */
+static void g_plugin_context_init(GPluginContext *);
+
+
+
+/* Indique le type défini pour une instance de greffon. */
+G_DEFINE_TYPE(GPluginContext, g_plugin_context, G_TYPE_OBJECT);
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : klass = classe à initialiser.                                *
+*                                                                             *
+*  Description : Initialise la classe des instances de greffon.               *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_plugin_context_class_init(GPluginContextClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : context = instance à initialiser.                            *
+*                                                                             *
+*  Description : Initialise une instance d'instance de greffon.               *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_plugin_context_init(GPluginContext *context)
+{
+
+}
diff --git a/src/plugins/context.h b/src/plugins/context.h
new file mode 100644
index 0000000..f4348e1
--- /dev/null
+++ b/src/plugins/context.h
@@ -0,0 +1,53 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * context.h - prototypes pour les instances d'actions d'un greffon donné
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _PLUGINS_CONTEXT_H
+#define _PLUGINS_CONTEXT_H
+
+
+#include <glib-object.h>
+
+
+
+/* Instance de greffon pour OpenIDA (instance) */
+typedef struct _GPluginContext GPluginContext;
+
+/* Instance de greffon pour OpenIDA (classe) */
+typedef struct _GPluginContextClass GPluginContextClass;
+
+
+#define G_TYPE_PLUGIN_CONTEXT                (g_plugin_context_get_type())
+#define G_PLUGIN_CONTEXT(obj)                (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_PLUGIN_CONTEXT, GPluginContext))
+#define G_IS_PLUGIN_CONTEXT(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_PLUGIN_CONTEXT))
+#define G_PLUGIN_CONTEXT_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_PLUGIN_CONTEXT, GPluginContextClass))
+#define G_IS_PLUGIN_CONTEXT_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_PLUGIN_CONTEXT))
+#define G_PLUGIN_CONTEXT_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PLUGIN_CONTEXT, GPluginContextClass))
+
+
+/* Indique le type défini pour une instance de greffon. */
+GType g_plugin_context_get_type(void);
+
+
+
+#endif  /* _PLUGINS_CONTEXT_H */
diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c
index 8139e08..f242cba 100644
--- a/src/plugins/pglist.c
+++ b/src/plugins/pglist.c
@@ -130,7 +130,7 @@ void browse_directory_for_plugins(plugins_list *list, const char *dir)
     int ret;                                /* Bilan du parcours           */
     char *filename;                         /* Elément à ausculter         */
     GPluginModule *plugin;                  /* Greffon à intégrer ou pas   */
-    return;
+
     ret = scandir(dir, &namelist, filter_dirs_or_mods, alphasort);
     if (ret < 0)
     {
diff --git a/src/plugins/plugin-def.h b/src/plugins/plugin-def.h
index adbabd4..50b8df2 100644
--- a/src/plugins/plugin-def.h
+++ b/src/plugins/plugin-def.h
@@ -30,6 +30,15 @@
 
 
 
+/* Types de greffon */
+typedef enum _PluginType
+{
+    PGT_BINARY          = (1 << 0)          /* Actions sur un binaire      */
+
+
+} PluginType;
+
+
 /* Action(s) menée(s) par le greffon */
 typedef enum _PluginAction
 {
@@ -41,6 +50,9 @@ typedef enum _PluginAction
 
 
 
+/* Fournit une indication sur le(s) type(s) du greffon présent. */
+typedef PluginType (* get_plugin_type_fc) (void);
+
 /* Fournit une indication sur le type d'opération(s) menée(s). */
 typedef PluginAction (* get_plugin_action_fc) (void);
 
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h
index 7e2703b..929dbf9 100644
--- a/src/plugins/plugin-int.h
+++ b/src/plugins/plugin-int.h
@@ -1,6 +1,6 @@
 
 /* OpenIDA - Outil d'analyse de fichiers binaires
- * elf-int.h - prototypes pour les structures internes du format ELF
+ * plugin-int.h - prototypes pour les structures internes des greffons
  *
  * Copyright (C) 2008 Cyrille Bagard
  *
@@ -45,6 +45,7 @@ struct _GPluginModule
 
     GModule *module;                        /* Abstration de manipulation  */
 
+    PluginType type;                        /* Type(s) du greffon          */
     PluginAction action;                    /* Opération(s) menée(s)       */
 
     init_plugin_fc init;                    /* Procédure d'initialisation  */
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 42bef63..2443768 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -41,7 +41,7 @@ static void g_plugin_module_init(GPluginModule *);
 
 
 
-/* Indique le type définit pour un greffon. */
+/* Indique le type défini pour un greffon. */
 G_DEFINE_TYPE(GPluginModule, g_plugin_module, G_TYPE_OBJECT);
 
 
@@ -98,7 +98,8 @@ static void g_plugin_module_init(GPluginModule *line)
 GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
 {
     GPluginModule *result;                  /* Structure à retourner       */
-    get_plugin_action_fc __get_action;        /* Actions du greffon          */
+    get_plugin_action_fc __get_type;        /* Type(s) de greffon          */
+    get_plugin_action_fc __get_action;      /* Actions du greffon          */
 
 
     result = g_object_new(G_TYPE_PLUGIN_MODULE, NULL);
@@ -107,6 +108,21 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
     result->module = g_module_open(filename, G_MODULE_BIND_LAZY);
 
 
+
+    if (!g_module_symbol(result->module, "get_plugin_type", (gpointer *)&__get_type))
+    {
+        printf("No 'get_plugin_type' symbol found in the plugin '%s'\n", filename);
+        goto bad_plugin;
+    }
+
+    result->type = __get_type();
+
+
+    printf("Plugin type :: 0x%08x\n", result->type);
+
+
+
+
 #if 1
     if (!g_module_symbol(result->module, "get_plugin_action", (gpointer *)&__get_action))
     {
@@ -148,6 +164,13 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref)
 
     return result;
 
+
+ bad_plugin:
+
+    g_object_unref(G_OBJECT(result));
+
+    return NULL;
+
 }
 
 
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index ddfb0c6..d17cee5 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -48,7 +48,7 @@ typedef struct _GPluginModuleClass GPluginModuleClass;
 #define G_PLUGIN_MODULE_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PLUGIN_MODULE, GPluginModuleClass))
 
 
-/* Indique le type définit pour un greffon. */
+/* Indique le type défini pour un greffon. */
 GType g_plugin_module_get_type(void);
 
 /* Crée un module pour un greffon donné. */
-- 
cgit v0.11.2-87-g4458