summaryrefslogtreecommitdiff
path: root/src/format/format.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2011-10-01 17:20:50 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2011-10-01 17:20:50 (GMT)
commit02cb3aa4e7b18b644b034a5c659c332becf99c9b (patch)
tree8d816e5f93820c6ef5ba804d7c0776a65d78329a /src/format/format.c
parente0266175537ec220544c050874be215b11c902fa (diff)
Defined the first real [python] plugin.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@210 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/format.c')
-rw-r--r--src/format/format.c54
1 files changed, 48 insertions, 6 deletions
diff --git a/src/format/format.c b/src/format/format.c
index 053a7aa..8e1d864 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -35,6 +35,7 @@
#include "pe/pe.h"
#include "../decomp/expr/block.h"
#include "../panels/log.h"
+#include "../plugins/pglist.h"
@@ -497,9 +498,10 @@ bool init_all_formats(void)
/******************************************************************************
* *
-* Paramètres : type = type de format recherché. *
-* content = contenu binaire à parcourir. *
-* length = taille du contenu en question. *
+* Paramètres : type = type de format recherché. *
+* filename = fichier d'origine des données initiales. *
+* content = contenu binaire à parcourir. [OUT] *
+* length = taille du contenu en question. [OUT] *
* *
* Description : Charge si possible un nouveau format binaire. *
* *
@@ -509,22 +511,62 @@ bool init_all_formats(void)
* *
******************************************************************************/
-GBinFormat *load_new_format(FormatType type, const uint8_t *content, off_t length)
+GBinFormat *load_new_format(FormatType type, char *filename, bin_t **content, off_t *length)
{
GBinFormat *result; /* Adresse à retourner */
+ GPluginModule **pglist; /* Liste de greffons */
+ size_t pgcount; /* Taille de cette liste */
size_t i; /* Boucle de parcours */
result = NULL;
+ printf("analysing... %s\n", filename);
+
+
+
+ pglist = get_all_plugins_for_action(PGA_FORMAT_MATCHER, &pgcount);
+
+ if (pgcount > 0)
+ {
+ lnf_rescan:
+
+ for (i = 0; i < pgcount; i++)
+ switch (g_plugin_module_is_matching(pglist[i], &filename, content, length))
+ {
+ case MFA_MATCHED:
+ /* FIXME */
+ break;
+
+ case MFA_RELOAD:
+ //goto lnf_rescan;
+ break;
+
+ default:
+ break;
+
+ }
+
+ free(pglist);
+
+ }
+
+
+
for (i = 0; i < FID_COUNT && result == NULL; i++)
- if (_formats[i].type == type && _formats[i].match(type, content, length))
+ if (_formats[i].type == type && _formats[i].match(type, *content, *length))
{
log_variadic_message(LMT_INFO, _("%s is matching..."), _formats[i].name);
- result = _formats[i].load(content, length);
+ result = _formats[i].load(*content, *length);
}
+
+
+ printf("FINAL FORMAT :: %p\n", result);
+
+ //exit(0);
+
return result;
}