diff options
Diffstat (limited to 'src/plugins/plugin.c')
-rw-r--r-- | src/plugins/plugin.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 9322bcb..c0e9fd1 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -37,6 +37,9 @@ #include "plugin-int.h" +#include "../core/formats.h" + + /* Initialise la classe des greffons. */ static void g_plugin_module_class_init(GPluginModuleClass *); @@ -162,8 +165,10 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref) GPluginModule *result; /* Structure à retourner */ plugin_abi_version_t current; /* Version de l'ABI actuelle */ size_t i; /* Boucle de parcours */ + uint32_t action; /* Identifiant d'une action */ uint32_t category; /* Catégorie principale */ uint32_t sub; /* Sous-catégorie visée */ + format_match_fc matcher; /* Routine de reconnaissance */ result = g_object_new(G_TYPE_PLUGIN_MODULE, NULL); @@ -215,8 +220,9 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref) for (i = 0; i < result->interface->actions_count; i++) { - category = MASK_PLUGIN_CATEGORY(result->interface->actions[i]); - sub = MASK_PLUGIN_SUB_CATEGORY(result->interface->actions[i]); + action = result->interface->actions[i]; + category = MASK_PLUGIN_CATEGORY(action); + sub = MASK_PLUGIN_SUB_CATEGORY(action); switch (category) { @@ -254,8 +260,18 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref) { case DPS_FORMAT: - switch (result->interface->actions[i]) + switch (action) { + case PGA_FORMAT_MATCHER: + + if (!load_plugin_symbol(result->module, + "is_format_matching", &matcher)) + goto bad_plugin; + + if (!register_format_matcher(matcher, result)) + goto bad_plugin; + + break; case PGA_FORMAT_LOADER_LAST: if (!load_plugin_symbol(result->module, @@ -275,7 +291,7 @@ GPluginModule *g_plugin_module_new(const gchar *filename, GObject *ref) case DPS_DISASSEMBLY: if (!load_plugin_symbol(result->module, - "process_binary_disassembly", &result->proc_disass)) + "process_binary_disassembly", &result->process_disass)) goto bad_plugin; break; @@ -504,6 +520,6 @@ bool g_plugin_module_handle_binary_format(const GPluginModule *plugin, PluginAct void g_plugin_module_process_disassembly_event(const GPluginModule *plugin, PluginAction action, GLoadedBinary *binary) { - plugin->proc_disass(plugin, action, binary); + plugin->process_disass(plugin, action, binary); } |