summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-08-29 22:30:58 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-08-29 22:30:58 (GMT)
commit6ba73df8224dc2a88fe5f37a331960936758036e (patch)
tree3db220cc946f3a23887016f3922fe94545e27620 /plugins
parentd91239074b9042988d08093948059096942bdcfc (diff)
Skipped the link to the global reference space when loading plugins.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mobicore/mobicore.c6
-rw-r--r--plugins/mobicore/mobicore.h4
-rw-r--r--plugins/pychrysa/plugin.c15
-rw-r--r--plugins/pychrysa/plugin.h2
-rw-r--r--plugins/pychrysa/pychrysa.c12
-rw-r--r--plugins/pychrysa/pychrysa.h2
-rw-r--r--plugins/ropgadgets/plugin.c16
-rw-r--r--plugins/ropgadgets/plugin.h2
-rw-r--r--plugins/ropgadgets/select.c14
-rw-r--r--plugins/ropgadgets/select.h5
10 files changed, 36 insertions, 42 deletions
diff --git a/plugins/mobicore/mobicore.c b/plugins/mobicore/mobicore.c
index 9ed8f32..ac2b7a9 100644
--- a/plugins/mobicore/mobicore.c
+++ b/plugins/mobicore/mobicore.c
@@ -40,7 +40,6 @@ DEFINE_CHRYSALIDE_ACTIVE_PLUGIN("Mobicore", "Support MobiCore file format for Tr
/******************************************************************************
* *
* Paramètres : plugin = greffon à manipuler. *
-* ref = espace de référencement global. *
* *
* Description : Prend acte du chargement du greffon. *
* *
@@ -50,7 +49,7 @@ DEFINE_CHRYSALIDE_ACTIVE_PLUGIN("Mobicore", "Support MobiCore file format for Tr
* *
******************************************************************************/
-G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
+G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)
{
bool result; /* Bilan à retourner */
@@ -68,7 +67,6 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
/******************************************************************************
* *
* Paramètres : plugin = greffon à manipuler. *
-* ref = espace de référencement global. *
* *
* Description : Prend acte du déchargement du greffon. *
* *
@@ -78,7 +76,7 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
* *
******************************************************************************/
-G_MODULE_EXPORT void chrysalide_plugin_exit(GPluginModule *plugin, GObject *ref)
+G_MODULE_EXPORT void chrysalide_plugin_exit(GPluginModule *plugin)
{
/* TODO */
diff --git a/plugins/mobicore/mobicore.h b/plugins/mobicore/mobicore.h
index 6e17557..e0db617 100644
--- a/plugins/mobicore/mobicore.h
+++ b/plugins/mobicore/mobicore.h
@@ -31,10 +31,10 @@
/* Prend acte du chargement du greffon. */
-G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *, GObject *);
+G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *);
/* Prend acte du déchargement du greffon. */
-G_MODULE_EXPORT void chrysalide_plugin_exit(GPluginModule *, GObject *);
+G_MODULE_EXPORT void chrysalide_plugin_exit(GPluginModule *);
diff --git a/plugins/pychrysa/plugin.c b/plugins/pychrysa/plugin.c
index 651de7d..7d44f10 100644
--- a/plugins/pychrysa/plugin.c
+++ b/plugins/pychrysa/plugin.c
@@ -71,7 +71,7 @@ static void g_python_plugin_init(GPythonPlugin *);
static bool g_python_plugin_read_interface(GPythonPlugin *);
/* Procède à l'initialisation du greffon. */
-static bool g_python_plugin_do_init(GPythonPlugin *, GObject *);
+static bool g_python_plugin_do_init(GPythonPlugin *);
/* Procède à l'extinction du greffon. */
static bool g_python_plugin_do_exit(GPythonPlugin *, GObject *);
@@ -141,7 +141,6 @@ static void g_python_plugin_init(GPythonPlugin *plugin)
* *
* Paramètres : modname = nom du module à charger. *
* filename = chemin d'accès au code Python à charger. *
-* ref = espace de référencement global. *
* *
* Description : Crée un greffon à partir de code Python. *
* *
@@ -151,7 +150,7 @@ static void g_python_plugin_init(GPythonPlugin *plugin)
* *
******************************************************************************/
-GPluginModule *g_python_plugin_new(const char *modname, const char *filename, GObject *ref)
+GPluginModule *g_python_plugin_new(const char *modname, const char *filename)
{
GPythonPlugin *result; /* Structure à retourner */
PyObject *name; /* Chemin d'accès pour Python */
@@ -346,7 +345,7 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename, GO
/* Conclusion */
- if (!g_plugin_module_load(G_PLUGIN_MODULE(result), ref))
+ if (!g_plugin_module_load(G_PLUGIN_MODULE(result)))
goto gppn_bad_plugin;
return G_PLUGIN_MODULE(result);
@@ -485,18 +484,18 @@ static bool g_python_plugin_read_interface(GPythonPlugin *plugin)
* *
******************************************************************************/
-static bool g_python_plugin_do_init(GPythonPlugin *plugin, GObject *ref)
+static bool g_python_plugin_do_init(GPythonPlugin *plugin)
{
bool result; /* Bilan à retourner */
PyObject *args; /* Arguments pour l'appel */
PyObject *value; /* Valeur obtenue */
- args = PyTuple_New(1);
- PyTuple_SetItem(args, 0, pygobject_new(ref));
+ args = Py_None;
+ Py_INCREF(args);
value = run_python_method(plugin->instance, "init", args);
- result = PyObject_IsTrue(value);
+ result = (value != NULL && PyObject_IsTrue(value));
Py_XDECREF(value);
Py_DECREF(args);
diff --git a/plugins/pychrysa/plugin.h b/plugins/pychrysa/plugin.h
index 04b65ef..ca451a8 100644
--- a/plugins/pychrysa/plugin.h
+++ b/plugins/pychrysa/plugin.h
@@ -57,7 +57,7 @@ typedef struct _GPythonPluginClass GPythonPluginClass;
GType g_python_plugin_get_type(void);
/* Crée un greffon à partir de code Python. */
-GPluginModule *g_python_plugin_new(const char *, const char *, GObject *);
+GPluginModule *g_python_plugin_new(const char *, const char *);
diff --git a/plugins/pychrysa/pychrysa.c b/plugins/pychrysa/pychrysa.c
index a404c1a..e9efc54 100644
--- a/plugins/pychrysa/pychrysa.c
+++ b/plugins/pychrysa/pychrysa.c
@@ -74,7 +74,7 @@ static bool is_current_abi_suitable(void);
static bool set_version_for_gtk_namespace(const char *);
/* Charge autant de greffons composés en Python que possible. */
-static bool load_python_plugins(GPluginModule *plugin, GObject *);
+static bool load_python_plugins(GPluginModule *);
@@ -402,7 +402,6 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
/******************************************************************************
* *
* Paramètres : plugin = instance représentant le greffon Python d'origine. *
-* ref = espace de référencement global. *
* *
* Description : Charge autant de greffons composés en Python que possible. *
* *
@@ -412,7 +411,7 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)
* *
******************************************************************************/
-static bool load_python_plugins(GPluginModule *plugin, GObject *ref)
+static bool load_python_plugins(GPluginModule *plugin)
{
char *paths; /* Emplacements de greffons */
char *save; /* Sauvegarde pour ré-entrance */
@@ -468,7 +467,7 @@ static bool load_python_plugins(GPluginModule *plugin, GObject *ref)
filename = stradd(filename, G_DIR_SEPARATOR_S);
filename = stradd(filename, entry->d_name);
- pyplugin = g_python_plugin_new(modname, filename, ref);
+ pyplugin = g_python_plugin_new(modname, filename);
if (pyplugin == NULL)
g_plugin_module_log_variadic_message(plugin, LMT_ERROR,
@@ -499,7 +498,6 @@ static bool load_python_plugins(GPluginModule *plugin, GObject *ref)
/******************************************************************************
* *
* Paramètres : plugin = greffon à manipuler. *
-* ref = espace de référencement global. *
* *
* Description : Prend acte du chargement du greffon. *
* *
@@ -509,7 +507,7 @@ static bool load_python_plugins(GPluginModule *plugin, GObject *ref)
* *
******************************************************************************/
-G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
+G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)
{
bool result; /* Bilan à retourner */
DIR *dir; /* Répertoire à parcourir */
@@ -548,7 +546,7 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
PySys_SetArgv(0, (wchar_t *[]) { NULL });
- result = load_python_plugins(plugin, ref);
+ result = load_python_plugins(plugin);
cpi_done:
diff --git a/plugins/pychrysa/pychrysa.h b/plugins/pychrysa/pychrysa.h
index 594d362..51d0470 100644
--- a/plugins/pychrysa/pychrysa.h
+++ b/plugins/pychrysa/pychrysa.h
@@ -89,7 +89,7 @@ PyMODINIT_FUNC initpychrysa(void);
PyMODINIT_FUNC PyInit_pychrysalide(void);
/* Prend acte du chargement du greffon. */
-G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *, GObject *);
+G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *);
diff --git a/plugins/ropgadgets/plugin.c b/plugins/ropgadgets/plugin.c
index c81d00a..8b35647 100644
--- a/plugins/ropgadgets/plugin.c
+++ b/plugins/ropgadgets/plugin.c
@@ -27,6 +27,7 @@
#include <i18n.h>
+#include <gui/core/global.h>
#include <gtkext/easygtk.h>
#include <plugins/plugin-def.h>
@@ -41,7 +42,7 @@ DEFINE_CHRYSALIDE_ACTIVE_PLUGIN("ROP gadgets", "Find available gadgets for a ROP
/* Réagit avec le menu "Greffons -> Lister les gadgets ROP". */
-static void mcb_plugins_list_rop_gadgets(GtkMenuItem *, GObject *);
+static void mcb_plugins_list_rop_gadgets(GtkMenuItem *, gpointer);
@@ -58,16 +59,19 @@ static void mcb_plugins_list_rop_gadgets(GtkMenuItem *, GObject *);
* *
******************************************************************************/
-G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
+G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin)
{
+ GObject *ref; /* Espace de référencements */
GtkContainer *menubar; /* Support pour éléments */
GtkWidget *submenuitem; /* Sous-élément de menu */
+ ref = G_OBJECT(get_editor_window()); /* FIXME */
+
menubar = GTK_CONTAINER(g_object_get_data(ref, "menubar_plugins"));
if (menubar == NULL) return false;
submenuitem = qck_create_menu_item(ref, "mnu_plugins_ropgadgets", _("List ROP gadgets"),
- G_CALLBACK(mcb_plugins_list_rop_gadgets), ref);
+ G_CALLBACK(mcb_plugins_list_rop_gadgets), NULL);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
return true;
@@ -78,7 +82,7 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
/******************************************************************************
* *
* Paramètres : menuitem = élément de menu sélectionné. *
-* ref = adresse de l'espace de référencement global. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit avec le menu "Greffons -> Lister les gadgets ROP". *
* *
@@ -88,8 +92,8 @@ G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *plugin, GObject *ref)
* *
******************************************************************************/
-static void mcb_plugins_list_rop_gadgets(GtkMenuItem *menuitem, GObject *ref)
+static void mcb_plugins_list_rop_gadgets(GtkMenuItem *menuitem, gpointer unused)
{
- run_rop_finder_assistant(ref, NULL);
+ run_rop_finder_assistant(get_editor_window());
}
diff --git a/plugins/ropgadgets/plugin.h b/plugins/ropgadgets/plugin.h
index 9f7a0a1..c76c6c7 100644
--- a/plugins/ropgadgets/plugin.h
+++ b/plugins/ropgadgets/plugin.h
@@ -30,7 +30,7 @@
/* Prend acte du chargement du greffon. */
-G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *, GObject *ref);
+G_MODULE_EXPORT bool chrysalide_plugin_init(GPluginModule *);
diff --git a/plugins/ropgadgets/select.c b/plugins/ropgadgets/select.c
index aa6603f..92456e7 100644
--- a/plugins/ropgadgets/select.c
+++ b/plugins/ropgadgets/select.c
@@ -41,6 +41,7 @@
#include <common/extstr.h>
#include <core/formats.h>
#include <core/processors.h>
+#include <gui/core/global.h>
#include <gtkext/easygtk.h>
@@ -222,8 +223,7 @@ static void add_new_gadgets_for_category(GExeFormat *, GtkComboBoxText *, GtkTre
/******************************************************************************
* *
-* Paramètres : global = espace de référencements global. *
-* parent = fenêtre principale de l'éditeur. *
+* Paramètres : parent = fenêtre principale de l'éditeur. *
* *
* Description : Crée et affiche un assistant de sélection de gadgets ROP. *
* *
@@ -233,7 +233,7 @@ static void add_new_gadgets_for_category(GExeFormat *, GtkComboBoxText *, GtkTre
* *
******************************************************************************/
-void run_rop_finder_assistant(GObject *global, GtkWindow *parent)
+void run_rop_finder_assistant(GtkWindow *parent)
{
GtkWidget *assistant; /* Fenêtre à afficher */
GObject *ref; /* Espace de référencement */
@@ -247,7 +247,6 @@ void run_rop_finder_assistant(GObject *global, GtkWindow *parent)
gtk_window_set_transient_for(GTK_WINDOW(assistant), parent);
ref = G_OBJECT(assistant);
- g_object_set_data(ref, "global", global);
register_input_output_panel(GTK_ASSISTANT(assistant), ref);
register_search_display_panel(GTK_ASSISTANT(assistant), ref);
@@ -503,7 +502,6 @@ static void register_input_output_panel(GtkAssistant *assistant, GObject *ref)
static GtkWidget *load_and_populate_current_project_binaries(GObject *ref)
{
GtkWidget *result; /* Composant à retourner */
- GObject *global; /* Espace de référencements */
GLoadedBinary *current; /* Binaire actif courant */
gint selected; /* Indice à sélectionner */
GtkListStore *store; /* Modèle de gestion en liste */
@@ -515,9 +513,7 @@ static GtkWidget *load_and_populate_current_project_binaries(GObject *ref)
/* Récupération du binaire courant */
- global = G_OBJECT(g_object_get_data(ref, "global"));
-
- current = G_LOADED_BINARY(g_object_get_data(global, "current_binary"));
+ current = get_current_binary();
/* Constitution d'une liste de binaires courants */
@@ -567,6 +563,8 @@ static GtkWidget *load_and_populate_current_project_binaries(GObject *ref)
g_object_unref(G_OBJECT(store));
+ g_object_unref(G_OBJECT(current));
+
return result;
}
diff --git a/plugins/ropgadgets/select.h b/plugins/ropgadgets/select.h
index a868cd8..913b6cc 100644
--- a/plugins/ropgadgets/select.h
+++ b/plugins/ropgadgets/select.h
@@ -28,12 +28,9 @@
#include <gtk/gtk.h>
-#include <analysis/binary.h>
-
-
/* Crée et affiche un assistant de sélection de gadgets ROP. */
-void run_rop_finder_assistant(GObject *, GtkWindow *);
+void run_rop_finder_assistant(GtkWindow *);