summaryrefslogtreecommitdiff
path: root/src/format/known.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/known.c')
-rw-r--r--src/format/known.c92
1 files changed, 40 insertions, 52 deletions
diff --git a/src/format/known.c b/src/format/known.c
index 7512ae1..bc03793 100644
--- a/src/format/known.c
+++ b/src/format/known.c
@@ -2,7 +2,7 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
* format.c - support des différents formats binaires reconnus
*
- * Copyright (C) 2019 Cyrille Bagard
+ * Copyright (C) 2019-2024 Cyrille Bagard
*
* This file is part of Chrysalide.
*
@@ -28,8 +28,8 @@
#include "known-int.h"
-#include "../analysis/storage/serialize-int.h"
-#include "../plugins/pglist.h"
+//#include "../analysis/storage/serialize-int.h"
+//#include "../plugins/pglist.h"
@@ -43,7 +43,7 @@ static void g_known_format_class_init(GKnownFormatClass *);
static void g_known_format_init(GKnownFormat *);
/* Procède à l'initialisation de l'interface de sérialisation. */
-static void g_known_format_serializable_init(GSerializableObjectInterface *);
+//static void g_known_format_serializable_init(GSerializableObjectInterface *);
/* Supprime toutes les références externes. */
static void g_known_format_dispose(GKnownFormat *);
@@ -56,6 +56,7 @@ static void g_known_format_finalize(GKnownFormat *);
/* -------------------- CONSERVATION ET RECHARGEMENT DES DONNEES -------------------- */
+#if 0
/* Charge un format depuis une mémoire tampon. */
static bool _g_known_format_load(GKnownFormat *, GObjectStorage *, packed_buffer_t *);
@@ -67,7 +68,7 @@ static bool _g_known_format_store(GKnownFormat *, GObjectStorage *, packed_buffe
/* Sauvegarde un format dans une mémoire tampon. */
static bool g_known_format_store(GKnownFormat *, GObjectStorage *, packed_buffer_t *);
-
+#endif
/* ---------------------------------------------------------------------------------- */
@@ -76,8 +77,9 @@ static bool g_known_format_store(GKnownFormat *, GObjectStorage *, packed_buffer
/* Indique le type défini pour un format binaire générique. */
-G_DEFINE_TYPE_WITH_CODE(GKnownFormat, g_known_format, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE(G_TYPE_SERIALIZABLE_OBJECT, g_known_format_serializable_init));
+//G_DEFINE_TYPE_WITH_CODE(GKnownFormat, g_known_format, G_TYPE_OBJECT,
+// G_IMPLEMENT_INTERFACE(G_TYPE_SERIALIZABLE_OBJECT, g_known_format_serializable_init));
+G_DEFINE_TYPE(GKnownFormat, g_known_format, G_TYPE_OBJECT);
/******************************************************************************
@@ -101,8 +103,10 @@ static void g_known_format_class_init(GKnownFormatClass *klass)
object->dispose = (GObjectFinalizeFunc/* ! */)g_known_format_dispose;
object->finalize = (GObjectFinalizeFunc)g_known_format_finalize;
+ /*
klass->load = (load_known_fc)_g_known_format_load;
klass->store = (store_known_fc)_g_known_format_store;
+ */
}
@@ -126,6 +130,7 @@ static void g_known_format_init(GKnownFormat *format)
}
+#if 0
/******************************************************************************
* *
* Paramètres : iface = interface GLib à initialiser. *
@@ -144,6 +149,7 @@ static void g_known_format_serializable_init(GSerializableObjectInterface *iface
iface->store = (store_serializable_object_cb)g_known_format_store;
}
+#endif
/******************************************************************************
@@ -188,24 +194,27 @@ static void g_known_format_finalize(GKnownFormat *format)
/******************************************************************************
* *
-* Paramètres : format = description du format connu à consulter. *
+* Paramètres : format = description du format à initialiser pleinement. *
* content = contenu binaire à parcourir. *
* *
-* Description : Définit le contenu binaire à analyser. *
+* Description : Met en place un nouveau contenu binaire à analyser. *
* *
-* Retour : - *
+* Retour : Bilan de l'opération. *
* *
* Remarques : - *
* *
******************************************************************************/
-void g_known_format_set_content(GKnownFormat *format, GBinContent *content)
+bool g_known_format_create(GKnownFormat *format, GBinContent *content)
{
- assert(format->content == NULL);
+ bool result; /* Bilan à retourner */
- g_object_ref_sink(G_OBJECT(content));
+ result = true;
format->content = content;
+ ref_object(content);
+
+ return result;
}
@@ -251,8 +260,13 @@ GBinContent *g_known_format_get_content(const GKnownFormat *format)
char *g_known_format_get_key(const GKnownFormat *format)
{
char *result; /* Désignation à retourner */
+ GKnownFormatClass *class; /* Classe de l'instance */
+
+ class = G_KNOWN_FORMAT_GET_CLASS(format);
- result = G_KNOWN_FORMAT_GET_CLASS(format)->get_key(format);
+ result = class->get_key(format);
+
+ //assert(result != NULL);
return result;
@@ -274,8 +288,13 @@ char *g_known_format_get_key(const GKnownFormat *format)
char *g_known_format_get_description(const GKnownFormat *format)
{
char *result; /* Description à retourner */
+ GKnownFormatClass *class; /* Classe de l'instance */
+
+ class = G_KNOWN_FORMAT_GET_CLASS(format);
+
+ result = class->get_desc(format);
- result = G_KNOWN_FORMAT_GET_CLASS(format)->get_desc(format);
+ //assert(result != NULL);
return result;
@@ -285,8 +304,6 @@ char *g_known_format_get_description(const GKnownFormat *format)
/******************************************************************************
* *
* Paramètres : format = format chargé dont l'analyse est lancée. *
-* gid = groupe de travail dédié. *
-* status = barre de statut à tenir informée. *
* *
* Description : Assure l'interprétation d'un format en différé. *
* *
@@ -296,60 +313,30 @@ char *g_known_format_get_description(const GKnownFormat *format)
* *
******************************************************************************/
-bool g_known_format_analyze(GKnownFormat *format, wgroup_id_t gid, GtkStatusStack *status)
+bool g_known_format_analyze(GKnownFormat *format)
{
bool result; /* Bilan à retourner */
GKnownFormatClass *class; /* Classe de l'instance */
- handle_known_format_analysis(PGA_FORMAT_ANALYSIS_STARTED, format, gid, status);
+ //handle_known_format_analysis(PGA_FORMAT_ANALYSIS_STARTED, format, gid, status);
class = G_KNOWN_FORMAT_GET_CLASS(format);
- result = class->analyze(format, gid, status);
+ result = class->analyze(format);
- handle_known_format_analysis(PGA_FORMAT_ANALYSIS_ENDED, format, gid, status);
+ //handle_known_format_analysis(PGA_FORMAT_ANALYSIS_ENDED, format, gid, status);
return result;
}
-/******************************************************************************
-* *
-* Paramètres : format = description de l'exécutable à manipuler. *
-* gid = groupe de travail dédié. *
-* status = barre de statut à tenir informée. *
-* *
-* Description : Réalise un traitement post-désassemblage. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_known_format_complete_analysis(GKnownFormat *format, wgroup_id_t gid, GtkStatusStack *status)
-{
- GKnownFormatClass *class; /* Classe de l'instance */
-
- handle_known_format_analysis(PGA_FORMAT_POST_ANALYSIS_STARTED, format, gid, status);
-
- class = G_KNOWN_FORMAT_GET_CLASS(format);
-
- if (class->complete != NULL)
- class->complete(format, gid, status);
-
- handle_known_format_analysis(PGA_FORMAT_POST_ANALYSIS_ENDED, format, gid, status);
-
-}
-
-
/* ---------------------------------------------------------------------------------- */
/* CONSERVATION ET RECHARGEMENT DES DONNEES */
/* ---------------------------------------------------------------------------------- */
-
+#if 0
/******************************************************************************
* *
* Paramètres : operand = élément GLib à constuire. *
@@ -468,3 +455,4 @@ static bool g_known_format_store(GKnownFormat *format, GObjectStorage *storage,
return result;
}
+#endif