diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/pychrysalide/Makefile.am | 3 | ||||
| -rw-r--r-- | plugins/pychrysalide/common/Makefile.am | 20 | ||||
| -rw-r--r-- | plugins/pychrysalide/common/bits.c | 32 | ||||
| -rw-r--r-- | plugins/pychrysalide/common/module.c | 18 | ||||
| -rw-r--r-- | plugins/pychrysalide/core.c | 6 | 
5 files changed, 49 insertions, 30 deletions
diff --git a/plugins/pychrysalide/Makefile.am b/plugins/pychrysalide/Makefile.am index a6abf7f..8408c96 100644 --- a/plugins/pychrysalide/Makefile.am +++ b/plugins/pychrysalide/Makefile.am @@ -57,6 +57,7 @@ AM_CFLAGS = $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) $(TOOLKIT_CFL  pychrysalide_la_LIBADD =					\  	analysis/libpychrysaanalysis4.la		\  	arch/libpychrysaarch4.la				\ +	common/libpychrysacommon.la				\  	core/libpychrysacore.la					\  	glibext/libpychrysaglibext.la			\  	plugins/libpychrysaplugins.la @@ -76,4 +77,4 @@ dev_HEADERS = $(pychrysalide_la_SOURCES:%c=)  #SUBDIRS = analysis arch common core debug format glibext $(GTKEXT_SUBDIR) $(GUI_SUBDIR) mangling plugins -SUBDIRS = analysis arch core glibext plugins +SUBDIRS = analysis arch common core glibext plugins diff --git a/plugins/pychrysalide/common/Makefile.am b/plugins/pychrysalide/common/Makefile.am index b5249b9..199ef43 100644 --- a/plugins/pychrysalide/common/Makefile.am +++ b/plugins/pychrysalide/common/Makefile.am @@ -1,16 +1,20 @@  noinst_LTLIBRARIES = libpychrysacommon.la +# libpychrysacommon_la_SOURCES =				\ +# 	bits.h bits.c							\ +# 	fnv1a.h fnv1a.c							\ +# 	hex.h hex.c								\ +# 	itoa.h itoa.c							\ +# 	leb128.h leb128.c						\ +# 	module.h module.c						\ +# 	packed.h packed.c						\ +# 	pathname.h pathname.c					\ +# 	pearson.h pearson.c +  libpychrysacommon_la_SOURCES =				\  	bits.h bits.c							\ -	fnv1a.h fnv1a.c							\ -	hex.h hex.c								\ -	itoa.h itoa.c							\ -	leb128.h leb128.c						\ -	module.h module.c						\ -	packed.h packed.c						\ -	pathname.h pathname.c					\ -	pearson.h pearson.c +	module.h module.c  libpychrysacommon_la_CFLAGS = $(TOOLKIT_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_INTERPRETER_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \  	-I$(top_srcdir)/src -DNO_IMPORT_PYGOBJECT diff --git a/plugins/pychrysalide/common/bits.c b/plugins/pychrysalide/common/bits.c index a127251..35d6ea4 100644 --- a/plugins/pychrysalide/common/bits.c +++ b/plugins/pychrysalide/common/bits.c @@ -534,27 +534,33 @@ static PyObject *py_bitfield_set_all(PyObject *self, PyObject *args)  static PyObject *py_bitfield_reset(PyObject *self, PyObject *args)  { -    unsigned long first;                    /* Indice du premier bit testé */      unsigned long count;                    /* Nombre de bits à analyser   */ +    unsigned long first;                    /* Indice du premier bit testé */      int ret;                                /* Bilan de lecture des args.  */      py_bitfield_t *bf;                      /* Instance à manipuler        */  #define BITFIELD_RESET_METHOD PYTHON_METHOD_DEF             \  (                                                           \ -    reset, "$self, first, count, /",                        \ +    reset, "$self, first, /, count=1",                      \      METH_VARARGS, py_bitfield,                              \      "Switch to 0 a part of bits in a bitfield.\n"           \      "\n"                                                    \      "The area to process starts at bit *first* and has a"   \ -    " size of *count* bits."                                \ +    " size of *count* bits (only one bit is processed if"   \ +    " no *size* is provided)."                              \  ) -    ret = PyArg_ParseTuple(args, "kk", &first, &count); +    count = 1; + +    ret = PyArg_ParseTuple(args, "k|k", &first, &count);      if (!ret) return NULL;      bf = (py_bitfield_t *)self; -    reset_in_bit_field(bf->native, first, count); +    if (count == 1) +        reset_in_bit_field(bf->native, first); +    else +        reset_multi_in_bit_field(bf->native, first, count);      Py_RETURN_NONE; @@ -576,27 +582,33 @@ static PyObject *py_bitfield_reset(PyObject *self, PyObject *args)  static PyObject *py_bitfield_set(PyObject *self, PyObject *args)  { -    unsigned long first;                    /* Indice du premier bit testé */      unsigned long count;                    /* Nombre de bits à analyser   */ +    unsigned long first;                    /* Indice du premier bit testé */      int ret;                                /* Bilan de lecture des args.  */      py_bitfield_t *bf;                      /* Instance à manipuler        */  #define BITFIELD_SET_METHOD PYTHON_METHOD_DEF               \  (                                                           \ -    set, "$self, first, count, /",                          \ +    set, "$self, first, /, count=1",                        \      METH_VARARGS, py_bitfield,                              \      "Switch to 1 a part of bits in a bitfield.\n"           \      "\n"                                                    \      "The area to process starts at bit *first* and has a"   \ -    " size of *count* bits."                                \ +    " size of *count* bits (only one bit is processed if"   \ +    " no *size* is provided)."                              \  ) -    ret = PyArg_ParseTuple(args, "kk", &first, &count); +    count = 1; + +    ret = PyArg_ParseTuple(args, "k|k", &first, &count);      if (!ret) return NULL;      bf = (py_bitfield_t *)self; -    set_in_bit_field(bf->native, first, count); +    if (count == 1) +        set_in_bit_field(bf->native, first); +    else +        set_multi_in_bit_field(bf->native, first, count);      Py_RETURN_NONE; diff --git a/plugins/pychrysalide/common/module.c b/plugins/pychrysalide/common/module.c index a0042ee..5fc1135 100644 --- a/plugins/pychrysalide/common/module.c +++ b/plugins/pychrysalide/common/module.c @@ -26,13 +26,13 @@  #include "bits.h" -#include "fnv1a.h" -#include "hex.h" -#include "itoa.h" -#include "leb128.h" -#include "packed.h" -#include "pathname.h" -#include "pearson.h" +//#include "fnv1a.h" +//#include "hex.h" +//#include "itoa.h" +//#include "leb128.h" +//#include "packed.h" +//#include "pathname.h" +//#include "pearson.h"  #include "../helpers.h" @@ -98,15 +98,17 @@ bool populate_common_module(void)      result = true; +    /*      if (result) result = populate_common_module_with_fnv1a();      if (result) result = populate_common_module_with_hex();      if (result) result = populate_common_module_with_itoa();      if (result) result = populate_common_module_with_leb128();      if (result) result = populate_common_module_with_pathname();      if (result) result = populate_common_module_with_pearson(); +    */      if (result) result = ensure_python_bitfield_is_registered(); -    if (result) result = ensure_python_packed_buffer_is_registered(); +    //if (result) result = ensure_python_packed_buffer_is_registered();      assert(result); diff --git a/plugins/pychrysalide/core.c b/plugins/pychrysalide/core.c index 4d744c7..8510d78 100644 --- a/plugins/pychrysalide/core.c +++ b/plugins/pychrysalide/core.c @@ -60,8 +60,8 @@  #include "struct.h"  #include "analysis/module.h"  #include "arch/module.h" +#include "common/module.h"  #include "glibext/module.h" -/* #include "common/module.h" */  /* #include "core/module.h" */  /* #include "debug/module.h" */  /* #include "format/module.h" */ @@ -645,9 +645,9 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)      if (status) status = add_analysis_module(result);      if (status) status = add_arch_module(result); +    if (status) status = add_common_module(result);      if (status) status = add_glibext_module(result);      /* -    if (status) status = add_common_module(result);      if (status) status = add_core_module(result);      if (status) status = add_debug_module(result);      if (status) status = add_format_module(result); @@ -669,8 +669,8 @@ PyMODINIT_FUNC PyInit_pychrysalide(void)      if (status) status = populate_analysis_module();      if (status) status = populate_arch_module();      if (status) status = populate_glibext_module(); -    /*      if (status) status = populate_common_module(); +    /*      if (status) status = populate_core_module();      if (status) status = populate_debug_module();      if (status) status = populate_format_module();  | 
