summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2024-05-14 21:29:40 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2024-05-14 21:29:40 (GMT)
commit7358dc2001d27d3c5a0c0fe39288b1a310a6d89e (patch)
treec83f3d52b11c72336dbabc4c1448c2ca4a375a36
parented57185faa4d7a53d953cf74a6f8626f44ce9b75 (diff)
Restore a minimal support for plugins.
-rw-r--r--src/Makefile.am5
-rw-r--r--src/common/Makefile.am6
-rw-r--r--src/common/bits.c2
-rw-r--r--src/common/xdg.c5
-rw-r--r--src/core/Makefile.am5
-rw-r--r--src/plugins/Makefile.am2
-rw-r--r--src/plugins/context-int.h49
-rw-r--r--src/plugins/context.c77
-rw-r--r--src/plugins/context.h53
-rw-r--r--src/plugins/dt.c2
-rw-r--r--src/plugins/pglist.h2
-rw-r--r--src/plugins/plugin-int.h10
-rw-r--r--src/plugins/plugin.c26
-rw-r--r--src/plugins/plugin.h9
14 files changed, 54 insertions, 199 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 4a81282..8df0b16 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -78,7 +78,8 @@ libchrysacore4_la_SOURCES =
libchrysacore4_la_LIBADD = \
common/libcommon4.la \
- core/libcore4.la
+ core/libcore4.la \
+ plugins/libplugins.la
libchrysacore4_la_LDFLAGS = \
$(TOOLKIT_LIBS)
@@ -175,4 +176,4 @@ rost_LDFLAGS = $(LIBGOBJ_LIBS) -L.libs -lchrysacore
#SUBDIRS = core glibext $(GTKEXT_SUBDIR) analysis arch format common debug $(GUI_SUBDIR) mangling plugins schemas
-SUBDIRS = common core glibext gtkext gui
+SUBDIRS = common core glibext gtkext gui plugins
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 53d3627..9d0885e 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -53,7 +53,11 @@ endif
libcommon4_la_SOURCES = \
- extstr.h extstr.c
+ asm.h asm.c \
+ bits.h bits.c \
+ extstr.h extstr.c \
+ pathname.h pathname.c \
+ xdg.h xdg.c
libcommon4_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS)
diff --git a/src/common/bits.c b/src/common/bits.c
index 3d0004c..37e3141 100644
--- a/src/common/bits.c
+++ b/src/common/bits.c
@@ -87,7 +87,7 @@ static bitfield_t *_create_bit_field(size_t length)
base = sizeof(bitfield_t) + needed * sizeof(unsigned long);
- result = (bitfield_t *)malloc(base);
+ result = malloc(base);
result->length = length;
diff --git a/src/common/xdg.c b/src/common/xdg.c
index 23feeb9..cabff75 100644
--- a/src/common/xdg.c
+++ b/src/common/xdg.c
@@ -79,7 +79,7 @@ char *get_xdg_config_dir(const char *suffix)
if (strcmp(entry->d_name, ".") == 0) continue;
if (strcmp(entry->d_name, "..") == 0) continue;
- result = (char *)calloc(strlen(env) + 2 + strlen(suffix) + 1, sizeof(char));
+ result = calloc(strlen(env) + 2 + strlen(suffix) + 1, sizeof(char));
strcpy(result, env);
if (env[strlen(env) - 1] != G_DIR_SEPARATOR)
@@ -101,8 +101,7 @@ char *get_xdg_config_dir(const char *suffix)
env = getenv("HOME");
if (env == NULL || env[0] == '\0') return NULL;
- result = (char *)calloc(strlen(env) + 1 + strlen(".config" G_DIR_SEPARATOR_S)
- + strlen(suffix) + 1, sizeof(char));
+ result = calloc(strlen(env) + 1 + strlen(".config" G_DIR_SEPARATOR_S) + strlen(suffix) + 1, sizeof(char));
strcpy(result, env);
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index f329a09..5bcb13a 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -17,8 +17,9 @@ libcore_la_SOURCES = \
libcore_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS)
-libcore4_la_SOURCES = \
- logs.h logs.c
+libcore4_la_SOURCES = \
+ logs.h logs.c \
+ paths.h paths.c
libcore4_la_CFLAGS = $(TOOLKIT_CFLAGS)
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 6cb8d34..dd191fa 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -2,8 +2,6 @@
noinst_LTLIBRARIES = libplugins.la
libplugins_la_SOURCES = \
- context-int.h \
- context.h context.c \
dt.h dt.c \
pglist.h pglist.c \
plugin-def.h \
diff --git a/src/plugins/context-int.h b/src/plugins/context-int.h
deleted file mode 100644
index 7a78314..0000000
--- a/src/plugins/context-int.h
+++ /dev/null
@@ -1,49 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * context-int.h - prototypes pour les structures internes des instances de greffon
- *
- * Copyright (C) 2010-2018 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#ifndef _FORMAT_PLUGINS_CONTEXT_INT_H
-#define _FORMAT_PLUGINS_CONTEXT_INT_H
-
-
-#include <glib-object.h>
-
-
-
-/* Instance de greffon pour Chrysalide (instance) */
-struct _GPluginContext
-{
- GObject parent; /* A laisser en premier */
-
-};
-
-
-/* Instance de greffon pour Chrysalide (classe) */
-struct _GPluginContextClass
-{
- GObjectClass parent; /* A laisser en premier */
-
-};
-
-
-
-#endif /* _FORMAT_PLUGINS_CONTEXT_INT_H */
diff --git a/src/plugins/context.c b/src/plugins/context.c
deleted file mode 100644
index f75b725..0000000
--- a/src/plugins/context.c
+++ /dev/null
@@ -1,77 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * context.c - instances d'actions d'un greffon donné
- *
- * Copyright (C) 2010-2016 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "context.h"
-
-
-#include "context-int.h"
-
-
-
-/* Initialise la classe des instances de greffon. */
-static void g_plugin_context_class_init(GPluginContextClass *);
-
-/* Initialise une instance d'instance de greffon. */
-static void g_plugin_context_init(GPluginContext *);
-
-
-
-/* Indique le type défini pour une instance de greffon. */
-G_DEFINE_TYPE(GPluginContext, g_plugin_context, G_TYPE_OBJECT);
-
-
-/******************************************************************************
-* *
-* Paramètres : klass = classe à initialiser. *
-* *
-* Description : Initialise la classe des instances de greffon. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_plugin_context_class_init(GPluginContextClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : context = instance à initialiser. *
-* *
-* Description : Initialise une instance d'instance de greffon. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void g_plugin_context_init(GPluginContext *context)
-{
-
-}
diff --git a/src/plugins/context.h b/src/plugins/context.h
deleted file mode 100644
index 61bd9ac..0000000
--- a/src/plugins/context.h
+++ /dev/null
@@ -1,53 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * context.h - prototypes pour les instances d'actions d'un greffon donné
- *
- * Copyright (C) 2010-2016 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _PLUGINS_CONTEXT_H
-#define _PLUGINS_CONTEXT_H
-
-
-#include <glib-object.h>
-
-
-
-/* Instance de greffon pour Chrysalide (instance) */
-typedef struct _GPluginContext GPluginContext;
-
-/* Instance de greffon pour Chrysalide (classe) */
-typedef struct _GPluginContextClass GPluginContextClass;
-
-
-#define G_TYPE_PLUGIN_CONTEXT (g_plugin_context_get_type())
-#define G_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_PLUGIN_CONTEXT, GPluginContext))
-#define G_IS_PLUGIN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_PLUGIN_CONTEXT))
-#define G_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_PLUGIN_CONTEXT, GPluginContextClass))
-#define G_IS_PLUGIN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_PLUGIN_CONTEXT))
-#define G_PLUGIN_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PLUGIN_CONTEXT, GPluginContextClass))
-
-
-/* Indique le type défini pour une instance de greffon. */
-GType g_plugin_context_get_type(void);
-
-
-
-#endif /* _PLUGINS_CONTEXT_H */
diff --git a/src/plugins/dt.c b/src/plugins/dt.c
index d678637..28b70bb 100644
--- a/src/plugins/dt.c
+++ b/src/plugins/dt.c
@@ -29,7 +29,7 @@
#include <string.h>
-#include "../plugins/pglist.h"
+#include "pglist.h"
diff --git a/src/plugins/pglist.h b/src/plugins/pglist.h
index 9063e78..83e9091 100644
--- a/src/plugins/pglist.h
+++ b/src/plugins/pglist.h
@@ -27,9 +27,11 @@
#include <stdbool.h>
+/*
#ifdef INCLUDE_GTK_SUPPORT
# include <gtk/gtk.h>
#endif
+*/
#include "plugin-def.h"
diff --git a/src/plugins/plugin-int.h b/src/plugins/plugin-int.h
index 067edcb..3ba19dc 100644
--- a/src/plugins/plugin-int.h
+++ b/src/plugins/plugin-int.h
@@ -30,12 +30,13 @@
#include "plugin.h"
+/*
#include "../analysis/content.h"
#include "../analysis/loaded.h"
+*/
#include "../common/bits.h"
-
/* Transfert de la conscience de soi. */
typedef void (* pg_set_self_fc) (GPluginModule *);
@@ -51,6 +52,8 @@ typedef gpointer (* pg_build_instance_fc) (GPluginModule *, PluginAction, GType)
/* Fournit le nom brut associé au greffon. */
typedef char * (* pg_get_modname_fc) (const GPluginModule *);
+#if 0
+
/* Procède à une opération liée à un contenu binaire. */
typedef void (* pg_handle_content_fc) (const GPluginModule *, PluginAction, GBinContent *, wgroup_id_t, GtkStatusStack *);
@@ -84,6 +87,7 @@ typedef void (* pg_process_disassembly_fc) (const GPluginModule *, PluginAction,
/* Effectue la détection d'effets d'outils externes. */
typedef void (* pg_detect_tools_fc) (const GPluginModule *, PluginAction, const GLoadedContent *, bool, char ***, size_t *);
+#endif
/* Greffon pour Chrysalide (instance) */
@@ -100,7 +104,7 @@ struct _GPluginModule
bitfield_t *dependencies; /* Cartographie des dépendances*/
- GGenConfig *config; /* Configuration dédiée */
+ //GGenConfig *config; /* Configuration dédiée */
};
@@ -119,6 +123,7 @@ struct _GPluginModuleClass
pg_get_modname_fc get_modname; /* Fourniture du nom brut */
+#if 0
#ifdef INCLUDE_GTK_SUPPORT
pg_include_theme_fc include_theme; /* Extension d'un thème */
pg_notify_panel_fc notify_panel; /* Création de panneau */
@@ -135,6 +140,7 @@ struct _GPluginModuleClass
pg_process_disassembly_fc process_disass; /* Catégorie 'désassemblage' */
pg_detect_tools_fc detect; /* Lancement de détections */
+#endif
};
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index b96decd..5b3e475 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -112,7 +112,7 @@ static void g_plugin_module_class_init(GPluginModuleClass *class)
static void g_plugin_module_init(GPluginModule *plugin)
{
- plugin->config = NULL;
+ //plugin->config = NULL;
}
@@ -168,6 +168,7 @@ static void g_plugin_module_dispose(GPluginModule *plugin)
if (class->exit != NULL)
class->exit(plugin);
+ /*
if (plugin->config != NULL)
{
g_generic_config_write(plugin->config);
@@ -175,6 +176,7 @@ static void g_plugin_module_dispose(GPluginModule *plugin)
g_clear_object(&plugin->config);
}
+ */
if (plugin->module != NULL)
{
@@ -365,6 +367,8 @@ GPluginModule *g_plugin_module_new(const gchar *filename)
break;
+#if 0
+
case DPC_GUI:
switch (sub)
@@ -489,6 +493,8 @@ GPluginModule *g_plugin_module_new(const gchar *filename)
}
+#endif
+
break;
default:
@@ -659,7 +665,7 @@ static void g_plugin_module_init_gclass(GPluginModuleClass *class, GModule *modu
}
break;
-
+#if 0
case DPC_GUI:
switch (sub)
@@ -786,6 +792,8 @@ static void g_plugin_module_init_gclass(GPluginModuleClass *class, GModule *modu
}
+#endif
+
break;
default:
@@ -1071,7 +1079,7 @@ bool g_plugin_module_load(GPluginModule *plugin, GPluginModule **list, size_t co
size_t i; /* Boucle de parcours */
GPluginModule *dependency; /* Module nécessaire */
GPluginModuleClass *class; /* Classe de l'instance active */
- GGenConfig *config; /* Configuration à charger */
+ //GGenConfig *config; /* Configuration à charger */
char *dir; /* Répertoire modifiable */
/* Si un essai précédent a déjà échoué ou réussi... */
@@ -1140,9 +1148,11 @@ bool g_plugin_module_load(GPluginModule *plugin, GPluginModule **list, size_t co
}
+ /*
config = g_plugin_module_get_config(plugin);
g_generic_config_read(config);
g_object_unref(G_OBJECT(config));
+ */
dir = strdup(plugin->filename);
dir = dirname(dir);
@@ -1233,7 +1243,7 @@ void g_plugin_module_create_config(GPluginModule *plugin)
filename = g_plugin_module_build_config_filename(plugin, "config.xml", false);
- plugin->config = g_generic_config_new_from_file(filename);
+ //plugin->config = g_generic_config_new_from_file(filename);
free(filename);
@@ -1251,7 +1261,7 @@ void g_plugin_module_create_config(GPluginModule *plugin)
* Remarques : - *
* *
******************************************************************************/
-
+#if 0
GGenConfig *g_plugin_module_get_config(const GPluginModule *plugin)
{
GGenConfig *result; /* Configuration à faire suivre*/
@@ -1264,6 +1274,7 @@ GGenConfig *g_plugin_module_get_config(const GPluginModule *plugin)
return result;
}
+#endif
/******************************************************************************
@@ -1438,6 +1449,9 @@ gpointer g_plugin_module_build_type_instance(GPluginModule *plugin, PluginAction
}
+
+#if 0
+
#ifdef INCLUDE_GTK_SUPPORT
@@ -1711,3 +1725,5 @@ void g_plugin_module_detect_external_tools(const GPluginModule *plugin, PluginAc
class->detect(plugin, action, content, version, names, count);
}
+
+#endif
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index b13608f..7e51f6e 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -30,6 +30,8 @@
#include "plugin-def.h"
+#include "../core/logs.h"
+#if 0
#include "../analysis/binary.h"
#include "../core/logs.h"
#include "../format/format.h"
@@ -40,6 +42,7 @@
#ifdef INCLUDE_GTK_SUPPORT
#include "../gui/panel.h"
#endif
+#endif
@@ -104,7 +107,7 @@ bool g_plugin_module_load(GPluginModule *, GPluginModule **, size_t);
char *g_plugin_module_build_config_filename(const GPluginModule *, const char *, bool);
/* Fournit la configuration mise en place pour le greffon. */
-GGenConfig *g_plugin_module_get_config(const GPluginModule *);
+//GGenConfig *g_plugin_module_get_config(const GPluginModule *);
/* Présente dans le journal un message simple. */
void g_plugin_module_log_simple_message(const GPluginModule *, LogMessageType, const char *);
@@ -121,6 +124,8 @@ void g_plugin_module_notify_plugins_loaded(GPluginModule *, PluginAction, void *
/* Crée une instance à partir d'un type dynamique externe. */
gpointer g_plugin_module_build_type_instance(GPluginModule *, PluginAction, GType);
+#if 0
+
#ifdef INCLUDE_GTK_SUPPORT
/* Complète une liste de resources pour thème. */
@@ -155,6 +160,8 @@ void g_plugin_module_process_disassembly_event(const GPluginModule *, PluginActi
/* Effectue la détection d'effets d'outils externes. */
void g_plugin_module_detect_external_tools(const GPluginModule *, PluginAction, const GLoadedContent *, bool, char ***, size_t *);
+#endif
+
#endif /* _PLUGINS_PLUGIN_H */