summaryrefslogtreecommitdiff
path: root/src/format
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
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')
-rwxr-xr-xsrc/format/dex/dex.c2
-rw-r--r--src/format/format.c54
-rw-r--r--src/format/format.h2
3 files changed, 51 insertions, 7 deletions
diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c
index 174bd2b..287c9ea 100755
--- a/src/format/dex/dex.c
+++ b/src/format/dex/dex.c
@@ -224,6 +224,8 @@ static void g_dex_format_find_all_sources(GDexFormat *format)
bf = G_BIN_FORMAT(format);
+ return; /* FIXME */
+
for (i = 0; i < format->classes_count; i++)
{
source = g_dex_class_get_source_file(format->classes[i], format);
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;
}
diff --git a/src/format/format.h b/src/format/format.h
index dd05dd2..7f0b649 100644
--- a/src/format/format.h
+++ b/src/format/format.h
@@ -121,7 +121,7 @@ typedef GBinFormat * (* format_load_fc) (const bin_t *, off_t);
bool init_all_formats(void);
/* Charge si possible un nouveau format binaire. */
-GBinFormat *load_new_format(FormatType, const uint8_t *, off_t);
+GBinFormat *load_new_format(FormatType, char *filename, bin_t **, off_t *);