summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2021-10-24 18:17:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2021-10-24 18:17:53 (GMT)
commita27f101ec7351a006537e819f9af55271620bc50 (patch)
treea4ca058dc05e71732234febf58160bf61957786e /src/analysis
parent810bce688d9b0e271d86886e182b62aa7166319f (diff)
Link a class to loaded content nature.
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/binary.c41
-rw-r--r--src/analysis/loaded-int.h6
-rw-r--r--src/analysis/loaded.c9
-rw-r--r--src/analysis/loaded.h4
-rw-r--r--src/analysis/project.c6
5 files changed, 48 insertions, 18 deletions
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index ddd2e30..5d604be 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -156,8 +156,8 @@ static bool g_loaded_binary_save(GLoadedBinary *, xmlDoc *, xmlXPathContext *, c
/* Fournit le contenu représenté de l'élément chargé. */
static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *);
-/* Fournit le contenu représenté de l'élément chargé. */
-static char *g_loaded_binary_get_format_name(const GLoadedBinary *);
+/* Décrit la nature du contenu reconnu pour l'élément chargé. */
+static char *g_loaded_binary_get_content_class(const GLoadedBinary *, bool);
/* Assure le désassemblage en différé. */
static bool g_loaded_binary_analyze(GLoadedBinary *, bool, bool, wgroup_id_t, GtkStatusStack *);
@@ -225,7 +225,7 @@ static void g_loaded_binary_class_init(GLoadedBinaryClass *klass)
loaded->save = (save_content_fc)g_loaded_binary_save;
loaded->get_content = (get_content_fc)g_loaded_binary_get_content;
- loaded->get_format_name = (get_format_name_fc)g_loaded_binary_get_format_name;
+ loaded->get_content_class = (get_content_class_fc)g_loaded_binary_get_content_class;
loaded->analyze = (analyze_loaded_fc)g_loaded_binary_analyze;
@@ -1310,9 +1310,10 @@ static bool g_loaded_binary_save(GLoadedBinary *binary, xmlDoc *xdoc, xmlXPathCo
}
+ /*
if (result)
{
- key = g_loaded_content_get_format_name(G_LOADED_CONTENT(binary));
+ key = g_loaded_content_get_content_class(G_LOADED_CONTENT(binary));
result = add_string_attribute_to_node(xdoc, context, path, "format", key);
free(key);
}
@@ -1323,6 +1324,7 @@ static bool g_loaded_binary_save(GLoadedBinary *binary, xmlDoc *xdoc, xmlXPathCo
result = add_string_attribute_to_node(xdoc, context, path, "arch", key);
free(key);
}
+ */
if (result)
result = g_loaded_binary_save_storage(binary, xdoc, context, path);
@@ -1366,6 +1368,7 @@ static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *binary)
/******************************************************************************
* *
* Paramètres : binary = élément chargé à manipuler. *
+* human = description humaine attendue ? *
* *
* Description : Fournit le contenu représenté de l'élément chargé. *
* *
@@ -1375,11 +1378,37 @@ static GBinContent *g_loaded_binary_get_content(const GLoadedBinary *binary)
* *
******************************************************************************/
-static char *g_loaded_binary_get_format_name(const GLoadedBinary *binary)
+static char *g_loaded_binary_get_content_class(const GLoadedBinary *binary, bool human)
{
char *result; /* Désignation à retourner */
+ char *part; /* Partie à intégrer */
+
+ if (human)
+ {
+ result = g_known_format_get_description(G_KNOWN_FORMAT(binary->format));
+
+ result = stradd(result, ", ");
+
+ part = g_arch_processor_get_desc(binary->proc);
+
+ result = stradd(result, part);
+
+ free(part);
+
+ }
+ else
+ {
+ result = g_known_format_get_key(G_KNOWN_FORMAT(binary->format));
+
+ result = stradd(result, "-");
- result = g_known_format_get_key(G_KNOWN_FORMAT(binary->format));
+ part = g_arch_processor_get_key(binary->proc);
+
+ result = stradd(result, part);
+
+ free(part);
+
+ }
return result;
diff --git a/src/analysis/loaded-int.h b/src/analysis/loaded-int.h
index cd47a6a..62534a6 100644
--- a/src/analysis/loaded-int.h
+++ b/src/analysis/loaded-int.h
@@ -39,8 +39,8 @@ typedef bool (* save_content_fc) (GLoadedContent *, xmlDoc *, xmlXPathContext *,
/* Fournit le contenu représenté de l'élément chargé. */
typedef GBinContent * (* get_content_fc) (const GLoadedContent *);
-/* Fournit le format associé à l'élément chargé. */
-typedef char * (* get_format_name_fc) (const GLoadedContent *);
+/* Décrit la nature du contenu reconnu pour l'élément chargé. */
+typedef char * (* get_content_class_fc) (const GLoadedContent *, bool);
/* Assure l'analyse d'un contenu chargé en différé. */
typedef bool (* analyze_loaded_fc) (GLoadedContent *, bool, bool, wgroup_id_t, GtkStatusStack *);
@@ -85,7 +85,7 @@ struct _GLoadedContentClass
save_content_fc save; /* Sauvegarde dans du XML */
get_content_fc get_content; /* Fourniture du contenu brut */
- get_format_name_fc get_format_name; /* Fourniture du format associé*/
+ get_content_class_fc get_content_class; /* Indication de classe liée */
analyze_loaded_fc analyze; /* Analyse du contenu chargé */
diff --git a/src/analysis/loaded.c b/src/analysis/loaded.c
index 3a497f9..9ec2f74 100644
--- a/src/analysis/loaded.c
+++ b/src/analysis/loaded.c
@@ -296,23 +296,24 @@ GBinContent *g_loaded_content_get_content(const GLoadedContent *content)
/******************************************************************************
* *
* Paramètres : content = élément chargé à manipuler. *
+* human = description humaine attendue ? *
* *
-* Description : Fournit le format associé à l'élément chargé. *
+* Description : Décrit la nature du contenu reconnu pour l'élément chargé. *
* *
-* Retour : Format associé à l'élément chargé. *
+* Retour : Classe de contenu associée à l'élément chargé. *
* *
* Remarques : - *
* *
******************************************************************************/
-char *g_loaded_content_get_format_name(const GLoadedContent *content)
+char *g_loaded_content_get_content_class(const GLoadedContent *content, bool human)
{
char *result; /* Contenu interne à renvoyer */
GLoadedContentClass *class; /* Classe de l'instance */
class = G_LOADED_CONTENT_GET_CLASS(content);
- result = class->get_format_name(content);
+ result = class->get_content_class(content, human);
return result;
diff --git a/src/analysis/loaded.h b/src/analysis/loaded.h
index 9a88f8c..406375c 100644
--- a/src/analysis/loaded.h
+++ b/src/analysis/loaded.h
@@ -67,8 +67,8 @@ bool g_loaded_content_save(GLoadedContent *, xmlDoc *, xmlXPathContext *, const
/* Fournit le contenu représenté de l'élément chargé. */
GBinContent *g_loaded_content_get_content(const GLoadedContent *);
-/* Fournit le format associé à l'élément chargé. */
-char *g_loaded_content_get_format_name(const GLoadedContent *);
+/* Décrit la nature du contenu reconnu pour l'élément chargé. */
+char *g_loaded_content_get_content_class(const GLoadedContent *, bool);
/* Lance l'analyse propre à l'élément chargé. */
void g_loaded_content_analyze(GLoadedContent *, bool, bool);
diff --git a/src/analysis/project.c b/src/analysis/project.c
index b57afc7..682dfb9 100644
--- a/src/analysis/project.c
+++ b/src/analysis/project.c
@@ -1249,12 +1249,12 @@ static void on_new_content_resolved(GContentResolver *resolver, wgroup_id_t wid,
hash = g_binary_content_get_checksum(content);
g_object_unref(G_OBJECT(content));
- format = g_loaded_content_get_format_name(available[i]);
+ format = "FIXME";//g_loaded_content_get_format_name(available[i]);
asprintf(&access, "/ChrysalideProject/LoadedContents/Content[@hash='%s' and @format='%s']",
hash, format);
- free(format);
+ //free(format);
xobject = get_node_xpath_object(handler->context, access);
@@ -1309,7 +1309,7 @@ static void on_new_content_resolved(GContentResolver *resolver, wgroup_id_t wid,
/**
* S'il s'agit des résultats de la dernière exploration,
* alors les groupes contenant les éléments chargés vont
- * être libéré, potentiellement pendant l'analyse.
+ * être libérés, potentiellement pendant l'analyse.
*
* On temporise en incrémentant les références.
*/