summaryrefslogtreecommitdiff
path: root/plugins/mobicore
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-09-19 22:28:42 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-09-19 22:28:42 (GMT)
commit0e3059731d9687027c913135b3b856596c49a689 (patch)
treed3c3754f95c90ae50168817e6248afee6873fbf3 /plugins/mobicore
parent18648e4e8763a3bc005d6fae51eae3d1528d7d29 (diff)
Extended the prototype for matching formats in order to get it suitable for plugins.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@577 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins/mobicore')
-rw-r--r--plugins/mobicore/mclf.c14
-rw-r--r--plugins/mobicore/mclf.h3
-rw-r--r--plugins/mobicore/mobicore.c6
3 files changed, 17 insertions, 6 deletions
diff --git a/plugins/mobicore/mclf.c b/plugins/mobicore/mclf.c
index 99ff7ed..4ff44bb 100644
--- a/plugins/mobicore/mclf.c
+++ b/plugins/mobicore/mclf.c
@@ -56,6 +56,8 @@ static void g_mclf_format_refine_portions(const GMCLFFormat *, GBinPortion *);
* *
* Paramètres : content = contenu binaire à parcourir. *
* parent = éventuel format exécutable déjà chargé. *
+* unused = adresse non utilisée ici. *
+* key = identifiant de format trouvé ou NULL. [OUT] *
* *
* Description : Indique si le format peut être pris en charge ici. *
* *
@@ -65,9 +67,9 @@ static void g_mclf_format_refine_portions(const GMCLFFormat *, GBinPortion *);
* *
******************************************************************************/
-const char *mclf_is_matching(GBinContent *content, GExeFormat *parent)
+FormatMatchStatus mclf_is_matching(GBinContent *content, GExeFormat *parent, void *unused, char **key)
{
- const char *result; /* Format détecté à renvoyer */
+ FormatMatchStatus result; /* Bilan à renvoyer */
vmpa2t addr; /* Tête de lecture initiale */
bool status; /* Bilan des accès mémoire */
char magic[4]; /* Idenfiant standard */
@@ -78,7 +80,13 @@ const char *mclf_is_matching(GBinContent *content, GExeFormat *parent)
status &= (memcmp(magic, MC_SERVICE_HEADER_MAGIC_STR, 4) == 0);
- result = status ? "mclf" : NULL;
+ if (status)
+ {
+ result = FMS_MATCHED;
+ *key = strdup("mclf");
+ }
+ else
+ result = FMS_UNKNOWN;
return result;
diff --git a/plugins/mobicore/mclf.h b/plugins/mobicore/mclf.h
index 5ac0926..78ed57b 100644
--- a/plugins/mobicore/mclf.h
+++ b/plugins/mobicore/mclf.h
@@ -30,6 +30,7 @@
#include <sys/types.h>
+#include <core/formats.h>
#include <format/executable.h>
#include <format/format.h>
@@ -51,7 +52,7 @@ typedef struct _GMCLFFormatClass GMCLFFormatClass;
/* Indique si le format peut être pris en charge ici. */
-const char *mclf_is_matching(GBinContent *, GExeFormat *);
+FormatMatchStatus mclf_is_matching(GBinContent *, GExeFormat *, void *, char **);
/* Indique le type défini pour un format d'exécutable MCLF. */
GType g_mclf_format_get_type(void);
diff --git a/plugins/mobicore/mobicore.c b/plugins/mobicore/mobicore.c
index 087297b..8a28a76 100644
--- a/plugins/mobicore/mobicore.c
+++ b/plugins/mobicore/mobicore.c
@@ -54,9 +54,11 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
{
bool result; /* Bilan à retourner */
- result &= register_format_matcher(mclf_is_matching);
+ result = true;
- result = register_format_loader("mclf", "MobiCore Load Format", g_mclf_format_new);
+ result &= register_format_matcher(mclf_is_matching, NULL);
+
+ result &= register_format_loader("mclf", "MobiCore Load Format", g_mclf_format_new);
return result;