diff options
Diffstat (limited to 'plugins/pychrysalide/format/format.c')
-rw-r--r-- | plugins/pychrysalide/format/format.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/plugins/pychrysalide/format/format.c b/plugins/pychrysalide/format/format.c index af881af..154bef3 100644 --- a/plugins/pychrysalide/format/format.c +++ b/plugins/pychrysalide/format/format.c @@ -31,6 +31,7 @@ #include <format/format.h> +#include "executable.h" #include "symbol.h" #include "symiter.h" #include "../access.h" @@ -239,21 +240,20 @@ static PyObject *py_binary_format_find_symbol_by_label(PyObject *self, PyObject static PyObject *py_binary_format_find_symbol_at(PyObject *self, PyObject *args) { PyObject *result; /* Valeur à retourner */ - PyObject *py_vmpa; /* Localisation version Python */ - int ret; /* Bilan de lecture des args. */ GBinFormat *format; /* Format de binaire manipulé */ + exe_cv_info_t conv; /* Informations de conversion */ + int ret; /* Bilan de lecture des args. */ GBinSymbol *symbol; /* Enventuel symbole trouvé */ bool found; /* Bilan de la recherche */ - ret = PyArg_ParseTuple(args, "O", &py_vmpa); - if (!ret) return NULL; + format = G_BIN_FORMAT(pygobject_get(self)); - ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type()); - if (!ret) return NULL; + conv.format = G_IS_EXE_FORMAT(format) ? G_EXE_FORMAT(format) : NULL; - format = G_BIN_FORMAT(pygobject_get(self)); + ret = PyArg_ParseTuple(args, "O&", convert_to_vmpa_using_executable, &conv); + if (!ret) return NULL; - found = g_binary_format_find_symbol_at(format, get_internal_vmpa(py_vmpa), &symbol); + found = g_binary_format_find_symbol_at(format, conv.vmpa, &symbol); if (found) { @@ -287,21 +287,20 @@ static PyObject *py_binary_format_find_symbol_at(PyObject *self, PyObject *args) static PyObject *py_binary_format_find_next_symbol_at(PyObject *self, PyObject *args) { PyObject *result; /* Valeur à retourner */ - PyObject *py_vmpa; /* Localisation version Python */ - int ret; /* Bilan de lecture des args. */ GBinFormat *format; /* Format de binaire manipulé */ + exe_cv_info_t conv; /* Informations de conversion */ + int ret; /* Bilan de lecture des args. */ GBinSymbol *symbol; /* Enventuel symbole trouvé */ bool found; /* Bilan de la recherche */ - ret = PyArg_ParseTuple(args, "O", &py_vmpa); - if (!ret) return NULL; + format = G_BIN_FORMAT(pygobject_get(self)); - ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type()); - if (!ret) return NULL; + conv.format = G_IS_EXE_FORMAT(format) ? G_EXE_FORMAT(format) : NULL; - format = G_BIN_FORMAT(pygobject_get(self)); + ret = PyArg_ParseTuple(args, "O&", convert_to_vmpa_using_executable, &conv); + if (!ret) return NULL; - found = g_binary_format_find_next_symbol_at(format, get_internal_vmpa(py_vmpa), &symbol); + found = g_binary_format_find_next_symbol_at(format, conv.vmpa, &symbol); if (found) { @@ -335,23 +334,22 @@ static PyObject *py_binary_format_find_next_symbol_at(PyObject *self, PyObject * static PyObject *py_binary_format_resolve_symbol(PyObject *self, PyObject *args) { PyObject *result; /* Valeur à retourner */ - PyObject *py_vmpa; /* Localisation version Python */ + GBinFormat *format; /* Format de binaire manipulé */ + exe_cv_info_t conv; /* Informations de conversion */ int strict; /* Tolérance acceptée */ int ret; /* Bilan de lecture des args. */ - GBinFormat *format; /* Format de binaire manipulé */ GBinSymbol *symbol; /* Enventuel symbole trouvé */ phys_t diff; /* Décalage éventuel mesuré */ bool found; /* Bilan de la recherche */ - ret = PyArg_ParseTuple(args, "Op", &py_vmpa, &strict); - if (!ret) return NULL; + format = G_BIN_FORMAT(pygobject_get(self)); - ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type()); - if (!ret) return NULL; + conv.format = G_IS_EXE_FORMAT(format) ? G_EXE_FORMAT(format) : NULL; - format = G_BIN_FORMAT(pygobject_get(self)); + ret = PyArg_ParseTuple(args, "O&p", convert_to_vmpa_using_executable, &conv, &strict); + if (!ret) return NULL; - found = g_binary_format_resolve_symbol(format, get_internal_vmpa(py_vmpa), strict, &symbol, &diff); + found = g_binary_format_resolve_symbol(format, conv.vmpa, strict, &symbol, &diff); if (found) { |