summaryrefslogtreecommitdiff
path: root/src/format/executable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/executable.c')
-rw-r--r--src/format/executable.c67
1 files changed, 57 insertions, 10 deletions
diff --git a/src/format/executable.c b/src/format/executable.c
index 80bfc9d..d0fc3e2 100644
--- a/src/format/executable.c
+++ b/src/format/executable.c
@@ -27,7 +27,6 @@
#include <assert.h>
#include <malloc.h>
#include <stdio.h>
-//#include <stdlib.h>
#include <i18n.h>
@@ -35,9 +34,10 @@
#include "executable-int.h"
#include "../core/logs.h"
-/*
-#include "../plugins/pglist.h"
-*/
+
+
+
+/* ------------------------- GESTION D'UN FORMAT EXECUTABLE ------------------------- */
/* Initialise la classe des formats d'exécutables génériques. */
@@ -54,6 +54,19 @@ static void g_executable_format_finalize(GExecutableFormat *);
+/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */
+
+
+/* Assure l'interprétation d'un format en différé. */
+static bool g_executable_format_analyze(GExecutableFormat *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GESTION D'UN FORMAT EXECUTABLE */
+/* ---------------------------------------------------------------------------------- */
+
+
/* Indique le type défini pour un format d'exécutable générique. */
G_DEFINE_TYPE(GExecutableFormat, g_executable_format, G_TYPE_PROGRAM_FORMAT);
@@ -73,12 +86,17 @@ G_DEFINE_TYPE(GExecutableFormat, g_executable_format, G_TYPE_PROGRAM_FORMAT);
static void g_executable_format_class_init(GExecutableFormatClass *klass)
{
GObjectClass *object; /* Autre version de la classe */
+ GKnownFormatClass *known; /* Version de format connu */
object = G_OBJECT_CLASS(klass);
object->dispose = (GObjectFinalizeFunc/* ! */)g_executable_format_dispose;
object->finalize = (GObjectFinalizeFunc)g_executable_format_finalize;
+ known = G_KNOWN_FORMAT_CLASS(klass);
+
+ known->analyze = (known_analyze_fc)g_executable_format_analyze;
+
}
@@ -159,7 +177,6 @@ bool g_executable_format_create(GExecutableFormat *format, GBinContent *content)
bool result; /* Bilan à retourner */
vmpa2t addr; /* Emplacement vide de sens */
phys_t length; /* Taille de portion globale */
- GExecutableFormatClass *class; /* Classe de l'instance */
result = g_program_format_create(G_PROGRAM_FORMAT(format), content);
if (!result) goto exit;
@@ -175,11 +192,6 @@ bool g_executable_format_create(GExecutableFormat *format, GBinContent *content)
format->portions = g_binary_portion_new(&addr, length);
- class = G_EXECUTABLE_FORMAT_GET_CLASS(format);
-
- if (class->refine_portions != NULL)
- result = class->refine_portions(format);
-
exit:
return result;
@@ -511,3 +523,38 @@ bool g_executable_format_translate_address_into_vmpa_with_portions(GExecutableFo
return result;
}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* IMPLEMENTATION DES FONCTIONS DE CLASSE */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : format = format chargé dont l'analyse est lancée. *
+* *
+* Description : Assure l'interprétation d'un format en différé. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool g_executable_format_analyze(GExecutableFormat *format)
+{
+ bool result; /* Bilan à retourner */
+ GExecutableFormatClass *class; /* Classe de l'instance */
+
+ class = G_EXECUTABLE_FORMAT_GET_CLASS(format);
+
+ if (class->refine_portions != NULL)
+ result = class->refine_portions(format);
+ else
+ result = true;
+
+ return result;
+
+}