From 52b72d15abbae6578c310fa1740b1802fe7b62b7 Mon Sep 17 00:00:00 2001 From: Angelo Dell'Aera Date: Thu, 5 Apr 2012 14:48:19 +0200 Subject: [PATCH 1/4] Generated new pylibemu.c --- src/pylibemu.c | 1701 ++++++++++++++++++++++------------------------ src/pylibemu.pxd | 2 +- src/pylibemu.pyx | 2 +- 3 files changed, 828 insertions(+), 877 deletions(-) diff --git a/src/pylibemu.c b/src/pylibemu.c index cb2e07f..ed1214c 100644 --- a/src/pylibemu.c +++ b/src/pylibemu.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.14.1 on Thu Apr 5 12:51:24 2012 */ +/* Generated by Cython 0.15.1 on Thu Apr 5 14:46:08 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -46,7 +46,7 @@ #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) @@ -159,6 +159,15 @@ #define PyBoolObject PyLongObject #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) @@ -209,16 +218,19 @@ #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" -#else -#define __PYX_EXTERN_C extern +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__pylibemu #define __PYX_HAVE_API__pylibemu #include "stdint.h" #include "stdio.h" @@ -238,6 +250,9 @@ #include "emu/environment/win32/emu_env_w32_dll_export.h" #include "emu/environment/emu_env.h" #include "emu/emu_shellcode.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS @@ -280,6 +295,7 @@ typedef struct {PyObject **p; char *s; const long n; const char* encoding; const #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); @@ -292,17 +308,17 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -317,12 +333,14 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "pylibemu.pyx", - "stringsource", "bool.pxd", "complex.pxd", }; -/* Type declarations */ +/*--- Type declarations ---*/ +struct __pyx_obj_8pylibemu_EmuProfile; +struct __pyx_obj_8pylibemu_Emulator; +struct __pyx_opt_args_8pylibemu_8Emulator_test; /* "pylibemu.pyx":510 * emu_cpu_reg32_set(emu_cpu_get(self._emu), esp, 0x0012fe98) @@ -331,7 +349,6 @@ static const char *__pyx_f[] = { * ''' * Method used to test and emulate the shellcode. The method must be always */ - struct __pyx_opt_args_8pylibemu_8Emulator_test { int __pyx_n; PyObject *steps; @@ -344,7 +361,6 @@ struct __pyx_opt_args_8pylibemu_8Emulator_test { * cdef char *sep[SEP_SIZE] * cdef char *output */ - struct __pyx_obj_8pylibemu_EmuProfile { PyObject_HEAD struct __pyx_vtabstruct_8pylibemu_EmuProfile *__pyx_vtab; @@ -356,6 +372,7 @@ struct __pyx_obj_8pylibemu_EmuProfile { int output_size; }; + /* "pylibemu.pyx":405 * * @@ -363,7 +380,6 @@ struct __pyx_obj_8pylibemu_EmuProfile { * cdef c_emu *_emu * cdef EmuProfile emu_profile */ - struct __pyx_obj_8pylibemu_Emulator { PyObject_HEAD struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtab; @@ -374,6 +390,7 @@ struct __pyx_obj_8pylibemu_Emulator { }; + /* "pylibemu.pyx":79 * * @@ -437,45 +454,36 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else + #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ @@ -489,13 +497,16 @@ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, PyObject *modname); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t); static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *); @@ -542,104 +553,110 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + +static int __Pyx_check_binary_version(void); static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from libc.stdint */ -/* Module declarations from cpython.version */ +/* Module declarations from 'libc.stdint' */ -/* Module declarations from cpython.ref */ +/* Module declarations from 'cpython.version' */ -/* Module declarations from cpython.exc */ +/* Module declarations from 'cpython.ref' */ -/* Module declarations from cpython.module */ +/* Module declarations from 'cpython.exc' */ -/* Module declarations from cpython.mem */ +/* Module declarations from 'cpython.module' */ -/* Module declarations from cpython.tuple */ +/* Module declarations from 'cpython.mem' */ -/* Module declarations from cpython.list */ +/* Module declarations from 'cpython.tuple' */ -/* Module declarations from libc.stdio */ +/* Module declarations from 'cpython.list' */ -/* Module declarations from cpython.object */ +/* Module declarations from 'libc.stdio' */ -/* Module declarations from cpython.sequence */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from cpython.mapping */ +/* Module declarations from 'cpython.sequence' */ -/* Module declarations from cpython.iterator */ +/* Module declarations from 'cpython.mapping' */ -/* Module declarations from cpython.type */ +/* Module declarations from 'cpython.iterator' */ -/* Module declarations from cpython.number */ +/* Module declarations from 'cpython.type' */ -/* Module declarations from cpython.int */ +/* Module declarations from 'cpython.number' */ -/* Module declarations from __builtin__ */ +/* Module declarations from 'cpython.int' */ -/* Module declarations from cpython.bool */ +/* Module declarations from '__builtin__' */ +/* Module declarations from 'cpython.bool' */ static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; -/* Module declarations from cpython.long */ -/* Module declarations from cpython.float */ +/* Module declarations from 'cpython.long' */ -/* Module declarations from __builtin__ */ +/* Module declarations from 'cpython.float' */ -/* Module declarations from cpython.complex */ +/* Module declarations from '__builtin__' */ +/* Module declarations from 'cpython.complex' */ static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; -/* Module declarations from cpython.string */ -/* Module declarations from cpython.unicode */ +/* Module declarations from 'cpython.string' */ + +/* Module declarations from 'cpython.unicode' */ -/* Module declarations from cpython.dict */ +/* Module declarations from 'cpython.dict' */ -/* Module declarations from cpython.instance */ +/* Module declarations from 'cpython.instance' */ -/* Module declarations from cpython.function */ +/* Module declarations from 'cpython.function' */ -/* Module declarations from cpython.method */ +/* Module declarations from 'cpython.method' */ -/* Module declarations from cpython.weakref */ +/* Module declarations from 'cpython.weakref' */ -/* Module declarations from cpython.getargs */ +/* Module declarations from 'cpython.getargs' */ -/* Module declarations from cpython.pythread */ +/* Module declarations from 'cpython.pythread' */ -/* Module declarations from cpython.cobject */ +/* Module declarations from 'cpython.pystate' */ -/* Module declarations from cpython.oldbuffer */ +/* Module declarations from 'cpython.cobject' */ -/* Module declarations from cpython.set */ +/* Module declarations from 'cpython.oldbuffer' */ -/* Module declarations from cpython.buffer */ +/* Module declarations from 'cpython.set' */ -/* Module declarations from cpython.bytes */ +/* Module declarations from 'cpython.buffer' */ -/* Module declarations from cpython.pycapsule */ +/* Module declarations from 'cpython.bytes' */ -/* Module declarations from cpython */ +/* Module declarations from 'cpython.pycapsule' */ -/* Module declarations from pylibemu */ +/* Module declarations from 'cpython' */ +/* Module declarations from 'pylibemu' */ static PyTypeObject *__pyx_ptype_8pylibemu_EmuProfile = 0; static PyTypeObject *__pyx_ptype_8pylibemu_Emulator = 0; static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *, struct emu_env_hook *, ...); /*proto*/ #define __Pyx_MODULE_NAME "pylibemu" -static int __pyx_module_is_main_pylibemu = 0; +int __pyx_module_is_main_pylibemu = 0; -/* Implementation of pylibemu */ +/* Implementation of 'pylibemu' */ static PyObject *__pyx_builtin_property; static PyObject *__pyx_builtin_open; static PyObject *__pyx_builtin_range; @@ -663,25 +680,12 @@ static char __pyx_k_22[] = "%s %s %s = %i (port=%i);\n"; static char __pyx_k_23[] = "%s none;\n"; static char __pyx_k_24[] = " = %i;\n"; static char __pyx_k_25[] = " = 0x%08x;\n"; -static char __pyx_k_26[] = "emu_profile_argument_debug"; -static char __pyx_k_27[] = "emu_profile_argument_render_int"; -static char __pyx_k_28[] = "emu_profile_argument_render_string"; -static char __pyx_k_29[] = "emu_profile_argument_render_bytea"; -static char __pyx_k_30[] = "emu_profile_argument_render_ptr"; -static char __pyx_k_31[] = "emu_profile_argument_render_ip"; -static char __pyx_k_32[] = "emu_profile_argument_render_port"; -static char __pyx_k_33[] = "emu_profile_argument_render_none"; -static char __pyx_k_34[] = "emu_profile_function_render_none"; -static char __pyx_k_35[] = "emu_profile_function_render_int"; -static char __pyx_k_36[] = "emu_profile_function_debug"; -static char __pyx_k_37[] = "urlmon.dll"; -static char __pyx_k_38[] = "repeat_current_instr"; -static char __pyx_k_39[] = "Unhooked call to %s\n"; -static char __pyx_k_41[] = "shellcode_getpc_test"; -static char __pyx_k_42[] = "%(asctime)s %(message)s"; -static char __pyx_k_43[] = "[%Y-%m-%d %H:%M:%S]"; -static char __pyx_k_44[] = "emu_profile_truncated"; -static char __pyx_k__s[] = "s"; +static char __pyx_k_26[] = "urlmon.dll"; +static char __pyx_k_27[] = "Unhooked call to %s\n"; +static char __pyx_k_29[] = "shellcode_getpc_test"; +static char __pyx_k_30[] = "%(asctime)s %(message)s"; +static char __pyx_k_31[] = "[%Y-%m-%d %H:%M:%S]"; +static char __pyx_k_32[] = "emu_profile_truncated"; static char __pyx_k__wb[] = "wb"; static char __pyx_k__eax[] = "eax"; static char __pyx_k__ebp[] = "ebp"; @@ -689,54 +693,34 @@ static char __pyx_k__ebx[] = "ebx"; static char __pyx_k__ecx[] = "ecx"; static char __pyx_k__edi[] = "edi"; static char __pyx_k__edx[] = "edx"; -static char __pyx_k__env[] = "env"; static char __pyx_k__esi[] = "esi"; static char __pyx_k__esp[] = "esp"; static char __pyx_k__md5[] = "md5"; static char __pyx_k__new[] = "new"; -static char __pyx_k__ptr[] = "ptr"; static char __pyx_k__reg[] = "reg"; static char __pyx_k__run[] = "run"; -static char __pyx_k__sep[] = "sep"; static char __pyx_k__sys[] = "sys"; static char __pyx_k__val[] = "val"; -static char __pyx_k__win[] = "win"; -static char __pyx_k___emu[] = "_emu"; static char __pyx_k__addr[] = "addr"; static char __pyx_k__free[] = "free"; -static char __pyx_k__hook[] = "hook"; static char __pyx_k__mode[] = "mode"; static char __pyx_k__open[] = "open"; static char __pyx_k__read[] = "read"; -static char __pyx_k__size[] = "size"; static char __pyx_k__test[] = "test"; -static char __pyx_k__tint[] = "tint"; -static char __pyx_k__tptr[] = "tptr"; static char __pyx_k__Error[] = "Error"; static char __pyx_k___exit[] = "_exit"; -static char __pyx_k__bytea[] = "bytea"; static char __pyx_k__dword[] = "dword"; static char __pyx_k__range[] = "range"; static char __pyx_k__steps[] = "steps"; -static char __pyx_k__tchar[] = "tchar"; -static char __pyx_k__value[] = "value"; static char __pyx_k__write[] = "write"; -static char __pyx_k__fnname[] = "fnname"; static char __pyx_k__format[] = "format"; static char __pyx_k__offset[] = "offset"; -static char __pyx_k__output[] = "output"; -static char __pyx_k__render[] = "render"; static char __pyx_k__socket[] = "socket"; -static char __pyx_k___offset[] = "_offset"; -static char __pyx_k__argname[] = "argname"; -static char __pyx_k__argtype[] = "argtype"; static char __pyx_k__datefmt[] = "datefmt"; static char __pyx_k__hashlib[] = "hashlib"; static char __pyx_k__logging[] = "logging"; static char __pyx_k__prepare[] = "prepare"; -static char __pyx_k__profile[] = "profile"; static char __pyx_k__timeout[] = "timeout"; -static char __pyx_k__tstruct[] = "tstruct"; static char __pyx_k__urllib2[] = "urllib2"; static char __pyx_k__urlopen[] = "urlopen"; static char __pyx_k__warning[] = "warning"; @@ -746,66 +730,30 @@ static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__property[] = "property"; static char __pyx_k__pylibemu[] = "pylibemu"; -static char __pyx_k__truncate[] = "truncate"; static char __pyx_k____enter__[] = "__enter__"; -static char __pyx_k__arguments[] = "arguments"; -static char __pyx_k__build_sep[] = "build_sep"; -static char __pyx_k__functions[] = "functions"; static char __pyx_k__hexdigest[] = "hexdigest"; static char __pyx_k__shellcode[] = "shellcode"; static char __pyx_k__basicConfig[] = "basicConfig"; -static char __pyx_k__concatenate[] = "concatenate"; -static char __pyx_k__emu_profile[] = "emu_profile"; static char __pyx_k__output_size[] = "output_size"; -static char __pyx_k__return_value[] = "return_value"; -static char __pyx_k__log_array_end[] = "log_array_end"; -static char __pyx_k__check_memalloc[] = "check_memalloc"; -static char __pyx_k__log_struct_end[] = "log_struct_end"; -static char __pyx_k__log_array_start[] = "log_array_start"; -static char __pyx_k__log_struct_start[] = "log_struct_start"; -static char __pyx_k__emu_profile_debug[] = "emu_profile_debug"; static char __pyx_k__URLDownloadToFileA[] = "URLDownloadToFileA"; static char __pyx_k__emu_profile_output[] = "emu_profile_output"; -static char __pyx_k__log_bracket_closed[] = "log_bracket_closed"; -static char __pyx_k__log_function_header[] = "log_function_header"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_s_2; -static PyObject *__pyx_n_s_26; -static PyObject *__pyx_n_s_27; -static PyObject *__pyx_n_s_28; +static PyObject *__pyx_kp_s_27; static PyObject *__pyx_n_s_29; -static PyObject *__pyx_n_s_30; -static PyObject *__pyx_n_s_31; +static PyObject *__pyx_kp_s_30; +static PyObject *__pyx_kp_s_31; static PyObject *__pyx_n_s_32; -static PyObject *__pyx_n_s_33; -static PyObject *__pyx_n_s_34; -static PyObject *__pyx_n_s_35; -static PyObject *__pyx_n_s_36; -static PyObject *__pyx_n_s_38; -static PyObject *__pyx_kp_s_39; static PyObject *__pyx_kp_s_4; -static PyObject *__pyx_n_s_41; -static PyObject *__pyx_kp_s_42; -static PyObject *__pyx_kp_s_43; -static PyObject *__pyx_n_s_44; static PyObject *__pyx_n_s__EMU_REGS; static PyObject *__pyx_n_s__Error; static PyObject *__pyx_n_s____enter__; static PyObject *__pyx_n_s____exit__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s___emu; static PyObject *__pyx_n_s___exit; -static PyObject *__pyx_n_s___offset; static PyObject *__pyx_n_s__addr; -static PyObject *__pyx_n_s__argname; -static PyObject *__pyx_n_s__argtype; -static PyObject *__pyx_n_s__arguments; static PyObject *__pyx_n_s__basicConfig; -static PyObject *__pyx_n_s__build_sep; -static PyObject *__pyx_n_s__bytea; -static PyObject *__pyx_n_s__check_memalloc; -static PyObject *__pyx_n_s__concatenate; static PyObject *__pyx_n_s__datefmt; static PyObject *__pyx_n_s__dword; static PyObject *__pyx_n_s__eax; @@ -814,65 +762,38 @@ static PyObject *__pyx_n_s__ebx; static PyObject *__pyx_n_s__ecx; static PyObject *__pyx_n_s__edi; static PyObject *__pyx_n_s__edx; -static PyObject *__pyx_n_s__emu_profile; -static PyObject *__pyx_n_s__emu_profile_debug; static PyObject *__pyx_n_s__emu_profile_output; -static PyObject *__pyx_n_s__env; static PyObject *__pyx_n_s__esi; static PyObject *__pyx_n_s__esp; -static PyObject *__pyx_n_s__fnname; static PyObject *__pyx_n_s__format; static PyObject *__pyx_n_s__free; -static PyObject *__pyx_n_s__functions; static PyObject *__pyx_n_s__hashlib; static PyObject *__pyx_n_s__hexdigest; -static PyObject *__pyx_n_s__hook; -static PyObject *__pyx_n_s__log_array_end; -static PyObject *__pyx_n_s__log_array_start; -static PyObject *__pyx_n_s__log_bracket_closed; -static PyObject *__pyx_n_s__log_function_header; -static PyObject *__pyx_n_s__log_struct_end; -static PyObject *__pyx_n_s__log_struct_start; static PyObject *__pyx_n_s__logging; static PyObject *__pyx_n_s__md5; static PyObject *__pyx_n_s__mode; static PyObject *__pyx_n_s__new; static PyObject *__pyx_n_s__offset; static PyObject *__pyx_n_s__open; -static PyObject *__pyx_n_s__output; static PyObject *__pyx_n_s__output_size; static PyObject *__pyx_n_s__prepare; -static PyObject *__pyx_n_s__profile; static PyObject *__pyx_n_s__property; -static PyObject *__pyx_n_s__ptr; static PyObject *__pyx_n_s__pylibemu; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__read; static PyObject *__pyx_n_s__reg; -static PyObject *__pyx_n_s__render; -static PyObject *__pyx_n_s__return_value; static PyObject *__pyx_n_s__run; -static PyObject *__pyx_n_s__s; -static PyObject *__pyx_n_s__sep; static PyObject *__pyx_n_s__shellcode; -static PyObject *__pyx_n_s__size; static PyObject *__pyx_n_s__socket; static PyObject *__pyx_n_s__steps; static PyObject *__pyx_n_s__sys; -static PyObject *__pyx_n_s__tchar; static PyObject *__pyx_n_s__test; static PyObject *__pyx_n_s__timeout; -static PyObject *__pyx_n_s__tint; -static PyObject *__pyx_n_s__tptr; -static PyObject *__pyx_n_s__truncate; -static PyObject *__pyx_n_s__tstruct; static PyObject *__pyx_n_s__urllib2; static PyObject *__pyx_n_s__urlopen; static PyObject *__pyx_n_s__val; -static PyObject *__pyx_n_s__value; static PyObject *__pyx_n_s__warning; static PyObject *__pyx_n_s__wb; -static PyObject *__pyx_n_s__win; static PyObject *__pyx_n_s__write; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; @@ -891,7 +812,7 @@ static PyObject *__pyx_k_tuple_5; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_9; -static PyObject *__pyx_k_tuple_40; +static PyObject *__pyx_k_tuple_28; /* "pylibemu.pyx":42 * @@ -901,41 +822,36 @@ static PyObject *__pyx_k_tuple_40; * cdef void *pCaller */ -static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { +static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { va_list __pyx_v_args; void *__pyx_v_pCaller; char *__pyx_v_szURL; char *__pyx_v_szFileName; int __pyx_v_dwReserved; void *__pyx_v_lpfnCB; - PyObject *__pyx_v_url; - PyObject *__pyx_v_content; - PyObject *__pyx_v_m; - PyObject *__pyx_v___tmpvar_2; - PyObject *__pyx_v___tmpvar_4; - PyObject *__pyx_v___tmpvar_5; - PyObject *__pyx_v___tmpvar_3; - PyObject *__pyx_v___tmpvar_1; - PyObject *__pyx_v_fd; + PyObject *__pyx_v_url = NULL; + PyObject *__pyx_v_content = NULL; + PyObject *__pyx_v_m = NULL; + PyObject *__pyx_v_fd = NULL; uint32_t __pyx_r; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("URLDownloadToFile"); - __pyx_v_url = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_content = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_m = Py_None; __Pyx_INCREF(Py_None); - __pyx_v___tmpvar_2 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v___tmpvar_4 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v___tmpvar_5 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v___tmpvar_3 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v___tmpvar_1 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_fd = Py_None; __Pyx_INCREF(Py_None); /* "pylibemu.pyx":51 * cdef void *p @@ -1046,11 +962,10 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env * content = url.read() */ { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); /*try:*/ { /* "pylibemu.pyx":61 @@ -1080,7 +995,6 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_url); __pyx_v_url = __pyx_t_1; __pyx_t_1 = 0; @@ -1096,13 +1010,12 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_content); __pyx_v_content = __pyx_t_3; __pyx_t_3 = 0; } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L10_try_end; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -1118,7 +1031,7 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env * return 0x800C0008 # INET_E_DOWNLOAD_FAILURE */ /*except:*/ { - __Pyx_AddTraceback("pylibemu.URLDownloadToFile"); + __Pyx_AddTraceback("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_1); @@ -1133,28 +1046,28 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env */ __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__logging); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__warning); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_8 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__warning); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyBytes_FromString(__pyx_v_szURL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4)); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_2), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "pylibemu.pyx":65 @@ -1175,22 +1088,22 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env goto __pyx_L4_exception_handled; } __pyx_L5_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L1_error; __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); goto __pyx_L0; __pyx_L4_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); __pyx_L10_try_end:; } @@ -1215,7 +1128,6 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_m); __pyx_v_m = __pyx_t_3; __pyx_t_3 = 0; @@ -1226,97 +1138,81 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env * fd.write(content) * */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_m, __pyx_n_s__hexdigest); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__wb)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_builtin_open, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v___tmpvar_2); - __pyx_v___tmpvar_2 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":2 - * MGR = EXPR - * EXIT = MGR.__exit__ # <<<<<<<<<<<<<< - * VALUE = MGR.__enter__() - * EXC = True - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v___tmpvar_2, __pyx_n_s____exit__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v___tmpvar_4); - __pyx_v___tmpvar_4 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "(tree fragment)":3 - * MGR = EXPR - * EXIT = MGR.__exit__ - * VALUE = MGR.__enter__() # <<<<<<<<<<<<<< - * EXC = True - * try: - */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v___tmpvar_2, __pyx_n_s____enter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - - /* "pylibemu.pyx":68 - * + /*with:*/ { + __pyx_t_3 = PyObject_GetAttr(__pyx_v_m, __pyx_n_s__hexdigest); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__wb)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_builtin_open, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_7 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____exit__); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /*try:*/ { + { + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_5, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_10); + /*try:*/ { + __pyx_v_fd = __pyx_t_1; + __pyx_t_1 = 0; + + /* "pylibemu.pyx":69 * m = hashlib.md5(content) - * with open(str(m.hexdigest()), mode = 'wb') as fd: # <<<<<<<<<<<<<< - * fd.write(content) + * with open(str(m.hexdigest()), mode = 'wb') as fd: + * fd.write(content) # <<<<<<<<<<<<<< * + * return 0 */ - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v___tmpvar_5); - __pyx_v___tmpvar_5 = __pyx_t_2; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v___tmpvar_3); - __pyx_v___tmpvar_3 = __pyx_t_2; - __pyx_t_2 = 0; - /*try:*/ { - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - __Pyx_XGOTREF(__pyx_save_exc_type); - __Pyx_XGOTREF(__pyx_save_exc_value); - __Pyx_XGOTREF(__pyx_save_exc_tb); - /*try:*/ { - __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_v___tmpvar_1); - __pyx_v___tmpvar_1 = Py_None; - - /* "(tree fragment)":8 - * try: - * EXCINFO = None - * TARGET = VALUE # <<<<<<<<<<<<<< - * BODY - * except: - */ - __Pyx_INCREF(__pyx_v___tmpvar_5); - __Pyx_DECREF(__pyx_v_fd); - __pyx_v_fd = __pyx_v___tmpvar_5; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_fd, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_content); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_content); + __Pyx_GIVEREF(__pyx_v_content); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L24_try_end; + __pyx_L17_error:; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pylibemu.pyx":68 * @@ -1325,182 +1221,77 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env * fd.write(content) * */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_fd, __pyx_n_s__write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_content); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_content); - __Pyx_GIVEREF(__pyx_v_content); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L16_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L23_try_end; - __pyx_L16_error:; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - /*except:*/ { - __Pyx_AddTraceback("pylibemu.URLDownloadToFile"); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v___tmpvar_1); - __pyx_v___tmpvar_1 = ((PyObject *)__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_v___tmpvar_3); - __pyx_v___tmpvar_3 = __pyx_t_4; - __pyx_t_4 = 0; - - /* "(tree fragment)":12 - * except: - * EXC = False - * if not EXIT(*EXCINFO): # <<<<<<<<<<<<<< - * raise - * finally: - */ - __pyx_t_4 = PySequence_Tuple(__pyx_v___tmpvar_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_6 = PyObject_Call(__pyx_v___tmpvar_4, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_8 = (!__pyx_t_7); - if (__pyx_t_8) { - - /* "pylibemu.pyx":68 - * - * m = hashlib.md5(content) - * with open(str(m.hexdigest()), mode = 'wb') as fd: # <<<<<<<<<<<<<< - * fd.write(content) - * - */ + /*except:*/ { + __Pyx_AddTraceback("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_INCREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __Pyx_ErrRestore(__pyx_t_3, __pyx_t_1, __pyx_t_2); - __pyx_t_3 = 0; __pyx_t_1 = 0; __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L18_except_error;} - goto __pyx_L26; + __Pyx_INCREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_12 = PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __pyx_t_13 = (!__pyx_t_11); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1); + __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + goto __pyx_L27; + } + __pyx_L27:; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L18_exception_handled; } - __pyx_L26:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L17_exception_handled; + __pyx_L19_except_error:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_10); + goto __pyx_L1_error; + __pyx_L18_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_10); + __pyx_L24_try_end:; } - __pyx_L18_except_error:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L14; - __pyx_L17_exception_handled:; - __Pyx_XGIVEREF(__pyx_save_exc_type); - __Pyx_XGIVEREF(__pyx_save_exc_value); - __Pyx_XGIVEREF(__pyx_save_exc_tb); - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L23_try_end:; - } - } - /*finally:*/ { - int __pyx_why; - PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; - int __pyx_exc_lineno; - __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; - __pyx_why = 0; goto __pyx_L15; - __pyx_L14: { - __pyx_why = 4; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); - __pyx_exc_lineno = __pyx_lineno; - goto __pyx_L15; - } - __pyx_L15:; - - /* "(tree fragment)":15 - * raise - * finally: - * if EXC: # <<<<<<<<<<<<<< - * EXIT(None, None, None) - * MGR = EXIT = VALUE = EXC = None - */ - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v___tmpvar_3); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L27_error;} - if (__pyx_t_8) { - - /* "pylibemu.pyx":68 - * - * m = hashlib.md5(content) - * with open(str(m.hexdigest()), mode = 'wb') as fd: # <<<<<<<<<<<<<< - * fd.write(content) - * - */ - __pyx_t_2 = PyObject_Call(__pyx_v___tmpvar_4, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L27_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L28; - } - __pyx_L28:; - __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_v___tmpvar_2); - __pyx_v___tmpvar_2 = Py_None; - __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_v___tmpvar_4); - __pyx_v___tmpvar_4 = Py_None; - __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_v___tmpvar_5); - __pyx_v___tmpvar_5 = Py_None; - __Pyx_INCREF(Py_None); - __Pyx_DECREF(__pyx_v___tmpvar_3); - __pyx_v___tmpvar_3 = Py_None; - goto __pyx_L29; - __pyx_L27_error:; - if (__pyx_why == 4) { - Py_XDECREF(__pyx_exc_type); - Py_XDECREF(__pyx_exc_value); - Py_XDECREF(__pyx_exc_tb); } - goto __pyx_L1_error; - __pyx_L29:; - switch (__pyx_why) { - case 4: { - __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); - __pyx_lineno = __pyx_exc_lineno; - __pyx_exc_type = 0; - __pyx_exc_value = 0; - __pyx_exc_tb = 0; - goto __pyx_L1_error; + /*finally:*/ { + if (__pyx_t_7) { + __pyx_t_10 = PyObject_Call(__pyx_t_7, __pyx_k_tuple_3, NULL); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_10); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } + goto __pyx_L28; + __pyx_L13_error:; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + goto __pyx_L1_error; + __pyx_L28:; } /* "pylibemu.pyx":71 @@ -1520,20 +1311,15 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_WriteUnraisable("pylibemu.URLDownloadToFile"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_WriteUnraisable("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_DECREF(__pyx_v_url); - __Pyx_DECREF(__pyx_v_content); - __Pyx_DECREF(__pyx_v_m); - __Pyx_DECREF(__pyx_v___tmpvar_2); - __Pyx_DECREF(__pyx_v___tmpvar_4); - __Pyx_DECREF(__pyx_v___tmpvar_5); - __Pyx_DECREF(__pyx_v___tmpvar_3); - __Pyx_DECREF(__pyx_v___tmpvar_1); - __Pyx_DECREF(__pyx_v_fd); + __Pyx_XDECREF(__pyx_v_url); + __Pyx_XDECREF(__pyx_v_content); + __Pyx_XDECREF(__pyx_v_m); + __Pyx_XDECREF(__pyx_v_fd); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -1550,37 +1336,44 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { size_t __pyx_v_output_size; int __pyx_r; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__output_size,0}; __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[1] = {0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output_size); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output_size); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } __pyx_v_output_size = __Pyx_PyInt_AsSize_t(values[0]); if (unlikely((__pyx_v_output_size == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_output_size = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_output_size == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pylibemu.EmuProfile.__cinit__"); + __Pyx_AddTraceback("pylibemu.EmuProfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; @@ -1665,7 +1458,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.__cinit__"); + __Pyx_AddTraceback("pylibemu.EmuProfile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -1680,13 +1473,17 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO * logging.warning("Memory allocation error") */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("check_memalloc"); /* "pylibemu.pyx":100 @@ -1747,7 +1544,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pylibemu.EmuProfile.check_memalloc"); + __Pyx_AddTraceback("pylibemu.EmuProfile.check_memalloc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1763,8 +1560,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj * return */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, char *__pyx_v_dst, char *__pyx_v_src, int __pyx_v_n) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, char *__pyx_v_dst, char *__pyx_v_src, int __pyx_v_n) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations size_t __pyx_t_1; size_t __pyx_t_2; int __pyx_t_3; @@ -1852,18 +1650,22 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8p * cdef int counter */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { char *__pyx_v_ssep; int __pyx_v_counter; int __pyx_v_i; int __pyx_v_max_len; char *__pyx_v_t; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations size_t __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("build_sep"); /* "pylibemu.pyx":115 @@ -2015,7 +1817,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyl __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("pylibemu.EmuProfile.build_sep"); + __Pyx_AddTraceback("pylibemu.EmuProfile.build_sep", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2031,9 +1833,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyl * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_function_header(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_function *__pyx_v_function) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_function_header(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_function *__pyx_v_function) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("log_function_header"); /* "pylibemu.pyx":143 @@ -2060,7 +1866,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_function_header(struct __py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.log_function_header"); + __Pyx_AddTraceback("pylibemu.EmuProfile.log_function_header", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2076,10 +1882,14 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_function_header(struct __py * */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { char *__pyx_v_s; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("log_bracket_closed"); /* "pylibemu.pyx":148 @@ -2106,7 +1916,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed(struct __pyx goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.log_bracket_closed"); + __Pyx_AddTraceback("pylibemu.EmuProfile.log_bracket_closed", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2122,9 +1932,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed(struct __pyx * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("log_array_start"); /* "pylibemu.pyx":158 @@ -2151,7 +1965,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_ob goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.log_array_start"); + __Pyx_AddTraceback("pylibemu.EmuProfile.log_array_start", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2167,9 +1981,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_ob * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("log_array_end"); /* "pylibemu.pyx":166 @@ -2196,7 +2014,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.log_array_end"); + __Pyx_AddTraceback("pylibemu.EmuProfile.log_array_end", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2212,9 +2030,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_ * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("log_struct_start"); /* "pylibemu.pyx":176 @@ -2241,7 +2063,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_o goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.log_struct_start"); + __Pyx_AddTraceback("pylibemu.EmuProfile.log_struct_start", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2257,9 +2079,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_o * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("log_struct_end"); /* "pylibemu.pyx":184 @@ -2286,7 +2112,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_end(struct __pyx_obj goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.log_struct_end"); + __Pyx_AddTraceback("pylibemu.EmuProfile.log_struct_end", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2302,9 +2128,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_end(struct __pyx_obj * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_argument_render_int"); /* "pylibemu.pyx":195 @@ -2331,7 +2161,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_int"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2347,9 +2177,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_string(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_string(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_argument_render_string"); /* "pylibemu.pyx":206 @@ -2376,7 +2210,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_str goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_string"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_string", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2392,9 +2226,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_str * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_bytea(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_bytea(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_argument_render_bytea"); /* "pylibemu.pyx":217 @@ -2421,7 +2259,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_byt goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_bytea"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_bytea", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2437,9 +2275,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_byt * snprintf(self.s, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_is_struct, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_is_struct, int __pyx_v_indent) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_argument_render_ptr"); /* "pylibemu.pyx":222 @@ -2489,7 +2331,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_ptr"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2505,11 +2347,15 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr * cdef char *host */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { struct in_addr *__pyx_v_addr; char *__pyx_v_host; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_argument_render_ip"); /* "pylibemu.pyx":245 @@ -2554,7 +2400,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip( goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_ip"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_ip", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2570,10 +2416,14 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip( * */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { uint16_t __pyx_v_port; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_argument_render_port"); /* "pylibemu.pyx":262 @@ -2609,7 +2459,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_por goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_port"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_port", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2625,9 +2475,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_por * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_argument_render_none"); /* "pylibemu.pyx":279 @@ -2654,7 +2508,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_non goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_none"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_render_none", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2670,8 +2524,9 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_non * */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("emu_profile_function_render_none"); /* "pylibemu.pyx":284 @@ -2700,9 +2555,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_non * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, int __pyx_v_value) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, int __pyx_v_value) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_function_render_int"); /* "pylibemu.pyx":290 @@ -2729,7 +2588,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_function_render_int"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_function_render_int", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2745,9 +2604,13 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, void *__pyx_v_ptr) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, void *__pyx_v_ptr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_function_render_ptr"); /* "pylibemu.pyx":298 @@ -2774,7 +2637,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_function_render_ptr"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_function_render_ptr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2790,13 +2653,17 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr * cdef c_emu_profile_argument *argumentit */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { struct emu_profile_argument *__pyx_v_argit; struct emu_profile_argument *__pyx_v_argumentit; int __pyx_v_is_struct; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_argument_debug"); /* "pylibemu.pyx":307 @@ -3329,7 +3196,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(stru goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_debug"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_argument_debug", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3345,17 +3212,20 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(stru * */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_function *__pyx_v_function) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_function *__pyx_v_function) { struct emu_profile_argument *__pyx_v_argument; - PyObject *__pyx_v_render; + PyObject *__pyx_v_render = NULL; int32_t __pyx_v_value; uint32_t __pyx_v_ptr; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_function_debug"); - __pyx_v_render = Py_None; __Pyx_INCREF(Py_None); /* "pylibemu.pyx":373 * @@ -3429,7 +3299,6 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(stru */ __pyx_t_1 = PyInt_FromLong(__pyx_v_function->return_value->render); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_render); __pyx_v_render = __pyx_t_1; __pyx_t_1 = 0; @@ -3557,10 +3426,10 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(stru __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_function_debug"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_function_debug", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_DECREF(__pyx_v_render); + __Pyx_XDECREF(__pyx_v_render); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -3574,11 +3443,15 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(stru * */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_env *__pyx_v__env) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_env *__pyx_v__env) { struct emu_profile_function *__pyx_v_function; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_debug"); /* "pylibemu.pyx":398 @@ -3626,7 +3499,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_debug"); + __Pyx_AddTraceback("pylibemu.EmuProfile.emu_profile_debug", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3646,44 +3519,50 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObje static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_output_size = 0; int __pyx_r; + __Pyx_RefNannyDeclarations size_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__output_size,0}; __Pyx_RefNannySetupContext("__cinit__"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[1] = {0}; values[0] = ((PyObject *)__pyx_int_1048576); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output_size); - if (value) { values[0] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output_size); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_output_size = values[0]; - } else { - __pyx_v_output_size = ((PyObject *)__pyx_int_1048576); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_output_size = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pylibemu.Emulator.__cinit__"); + __Pyx_AddTraceback("pylibemu.Emulator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; @@ -3717,7 +3596,7 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObje __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pylibemu.Emulator.__cinit__"); + __Pyx_AddTraceback("pylibemu.Emulator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3734,8 +3613,12 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObje static void __pyx_pf_8pylibemu_8Emulator_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_8pylibemu_8Emulator_1__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__dealloc__"); /* "pylibemu.pyx":416 @@ -3756,7 +3639,7 @@ static void __pyx_pf_8pylibemu_8Emulator_1__dealloc__(PyObject *__pyx_v_self) { __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pylibemu.Emulator.__dealloc__"); + __Pyx_AddTraceback("pylibemu.Emulator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_RefNannyFinishContext(); } @@ -3772,6 +3655,7 @@ static void __pyx_pf_8pylibemu_8Emulator_1__dealloc__(PyObject *__pyx_v_self) { static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("free"); @@ -3823,8 +3707,12 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTH static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("new"); /* "pylibemu.pyx":424 @@ -3864,7 +3752,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHO __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pylibemu.Emulator.new"); + __Pyx_AddTraceback("pylibemu.Emulator.new", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3883,9 +3771,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHO static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v_self, PyObject *__pyx_v_output_size); /*proto*/ static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v_self, PyObject *__pyx_v_output_size) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; size_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_output_size"); /* "pylibemu.pyx":428 @@ -3931,7 +3823,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("pylibemu.Emulator.set_output_size"); + __Pyx_AddTraceback("pylibemu.Emulator.set_output_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3953,11 +3845,15 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ char *__pyx_v_buffer; Py_ssize_t __pyx_v_sclen; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; char *__pyx_t_4; Py_ssize_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("shellcode_getpc_test"); /* "pylibemu.pyx":448 @@ -3995,7 +3891,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ * */ __pyx_t_4 = PyBytes_AsString(__pyx_v_shellcode); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_buffer = __pyx_t_4; + __pyx_v_buffer = ((char *)__pyx_t_4); /* "pylibemu.pyx":452 * @@ -4069,7 +3965,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pylibemu.Emulator.shellcode_getpc_test"); + __Pyx_AddTraceback("pylibemu.Emulator.shellcode_getpc_test", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4096,6 +3992,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P int __pyx_v_j; int __pyx_v_static_offset; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; @@ -4103,45 +4000,51 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P char *__pyx_t_5; Py_ssize_t __pyx_t_6; uint32_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shellcode,&__pyx_n_s__offset,0}; __Pyx_RefNannySetupContext("prepare"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shellcode); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("prepare", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "prepare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shellcode); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("prepare", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "prepare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_shellcode = values[0]; __pyx_v_offset = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_shellcode = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_offset = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("prepare", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pylibemu.Emulator.prepare"); + __Pyx_AddTraceback("pylibemu.Emulator.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; @@ -4309,7 +4212,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P * emu_memory_write_block(_mem, static_offset, scode, len(shellcode)) */ __pyx_t_5 = PyBytes_AsString(__pyx_v_shellcode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_scode = __pyx_t_5; + __pyx_v_scode = ((char *)__pyx_t_5); /* "pylibemu.pyx":501 * # Write the code to the offset @@ -4370,7 +4273,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pylibemu.Emulator.prepare"); + __Pyx_AddTraceback("pylibemu.Emulator.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4387,7 +4290,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P */ static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_test *__pyx_optional_args) { +static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_test *__pyx_optional_args) { PyObject *__pyx_v_steps = ((PyObject *)__pyx_int_1000000); struct emu_cpu *__pyx_v__cpu; struct emu_memory *__pyx_v__mem; @@ -4397,12 +4300,16 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator int __pyx_v_ret; struct emu_env_hook *__pyx_v_hook; int __pyx_r; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; long __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("test"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { @@ -4570,7 +4477,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * emu_env_w32_export_hook(_env, "URLDownloadToFileA", URLDownloadToFile, NULL) * */ - emu_env_w32_load_dll(__pyx_v__env->env.win, __pyx_k_37); + emu_env_w32_load_dll(__pyx_v__env->env.win, __pyx_k_26); /* "pylibemu.pyx":546 * @@ -4680,7 +4587,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_39), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_27), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4780,7 +4687,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__warning); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_40), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4843,7 +4750,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("pylibemu.Emulator.test"); + __Pyx_WriteUnraisable("pylibemu.Emulator.test", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -4863,44 +4770,50 @@ static char __pyx_doc_8pylibemu_8Emulator_7test[] = "\n Method used to te static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_steps = 0; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; struct __pyx_opt_args_8pylibemu_8Emulator_test __pyx_t_2; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__steps,0}; __Pyx_RefNannySetupContext("test"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[1] = {0}; values[0] = ((PyObject *)__pyx_int_1000000); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__steps); - if (value) { values[0] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__steps); + if (value) { values[0] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "test") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "test") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_steps = values[0]; - } else { - __pyx_v_steps = ((PyObject *)__pyx_int_1000000); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_steps = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("test", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pylibemu.Emulator.test"); + __Pyx_AddTraceback("pylibemu.Emulator.test", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; @@ -4918,7 +4831,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyOb goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("pylibemu.Emulator.test"); + __Pyx_AddTraceback("pylibemu.Emulator.test", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4935,15 +4848,19 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyOb */ static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode); /*proto*/ -static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode, int __pyx_skip_dispatch) { +static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode, int __pyx_skip_dispatch) { int32_t __pyx_v_offset; int __pyx_r; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int32_t __pyx_t_5; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("run"); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; @@ -4976,7 +4893,7 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * if offset < 0: * offset = 0 */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_41); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); @@ -5054,7 +4971,7 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("pylibemu.Emulator.run"); + __Pyx_WriteUnraisable("pylibemu.Emulator.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -5072,7 +4989,11 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode); /*proto*/ static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("run"); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_8pylibemu_Emulator *)((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->__pyx_vtab)->run(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_shellcode, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5085,7 +5006,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObj goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.Emulator.run"); + __Pyx_AddTraceback("pylibemu.Emulator.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5104,7 +5025,11 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObj static PyObject *__pyx_pf_8pylibemu_8Emulator_9offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8pylibemu_8Emulator_9offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("offset"); /* "pylibemu.pyx":588 @@ -5125,7 +5050,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_9offset(PyObject *__pyx_v_self, CY goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.Emulator.offset"); + __Pyx_AddTraceback("pylibemu.Emulator.offset", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5144,7 +5069,11 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_9offset(PyObject *__pyx_v_self, CY static PyObject *__pyx_pf_8pylibemu_8Emulator_10emu_profile_output(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8pylibemu_8Emulator_10emu_profile_output(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_output"); /* "pylibemu.pyx":592 @@ -5165,7 +5094,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10emu_profile_output(PyObject *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.Emulator.emu_profile_output"); + __Pyx_AddTraceback("pylibemu.Emulator.emu_profile_output", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5184,7 +5113,11 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10emu_profile_output(PyObject *__p static PyObject *__pyx_pf_8pylibemu_8Emulator_11emu_profile_truncated(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pf_8pylibemu_8Emulator_11emu_profile_truncated(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_truncated"); /* "pylibemu.pyx":596 @@ -5205,7 +5138,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_11emu_profile_truncated(PyObject * goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("pylibemu.Emulator.emu_profile_truncated"); + __Pyx_AddTraceback("pylibemu.Emulator.emu_profile_truncated", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5227,48 +5160,55 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12memory_write_dword(PyObject *__p PyObject *__pyx_v_dword = 0; struct emu_memory *__pyx_v__mem; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; uint32_t __pyx_t_2; uint32_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__addr,&__pyx_n_s__dword,0}; __Pyx_RefNannySetupContext("memory_write_dword"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dword); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "memory_write_dword") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dword); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "memory_write_dword") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_addr = values[0]; __pyx_v_dword = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_addr = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_dword = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pylibemu.Emulator.memory_write_dword"); + __Pyx_AddTraceback("pylibemu.Emulator.memory_write_dword", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; @@ -5333,7 +5273,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12memory_write_dword(PyObject *__p __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pylibemu.Emulator.memory_write_dword"); + __Pyx_AddTraceback("pylibemu.Emulator.memory_write_dword", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5355,48 +5295,55 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_13cpu_reg32_set(PyObject *__pyx_v_ PyObject *__pyx_v_val = 0; struct emu_cpu *__pyx_v__cpu; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; enum emu_reg32 __pyx_t_2; uint32_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reg,&__pyx_n_s__val,0}; __Pyx_RefNannySetupContext("cpu_reg32_set"); - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reg); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__val); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cpu_reg32_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reg); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__val); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cpu_reg32_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_reg = values[0]; __pyx_v_val = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_reg = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_val = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("pylibemu.Emulator.cpu_reg32_set"); + __Pyx_AddTraceback("pylibemu.Emulator.cpu_reg32_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; @@ -5461,7 +5408,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_13cpu_reg32_set(PyObject *__pyx_v_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("pylibemu.Emulator.cpu_reg32_set"); + __Pyx_AddTraceback("pylibemu.Emulator.cpu_reg32_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5882,42 +5829,21 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, - {&__pyx_n_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 1}, - {&__pyx_n_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 1}, - {&__pyx_n_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 1}, + {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, {&__pyx_n_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 1}, - {&__pyx_n_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 1}, - {&__pyx_n_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 1}, + {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0}, + {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0}, {&__pyx_n_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 1}, - {&__pyx_n_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 1}, - {&__pyx_n_s_34, __pyx_k_34, sizeof(__pyx_k_34), 0, 0, 1, 1}, - {&__pyx_n_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 1}, - {&__pyx_n_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 1}, - {&__pyx_n_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 1}, - {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0}, {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, - {&__pyx_n_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 1}, - {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0}, - {&__pyx_kp_s_43, __pyx_k_43, sizeof(__pyx_k_43), 0, 0, 1, 0}, - {&__pyx_n_s_44, __pyx_k_44, sizeof(__pyx_k_44), 0, 0, 1, 1}, {&__pyx_n_s__EMU_REGS, __pyx_k__EMU_REGS, sizeof(__pyx_k__EMU_REGS), 0, 0, 1, 1}, {&__pyx_n_s__Error, __pyx_k__Error, sizeof(__pyx_k__Error), 0, 0, 1, 1}, {&__pyx_n_s____enter__, __pyx_k____enter__, sizeof(__pyx_k____enter__), 0, 0, 1, 1}, {&__pyx_n_s____exit__, __pyx_k____exit__, sizeof(__pyx_k____exit__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s___emu, __pyx_k___emu, sizeof(__pyx_k___emu), 0, 0, 1, 1}, {&__pyx_n_s___exit, __pyx_k___exit, sizeof(__pyx_k___exit), 0, 0, 1, 1}, - {&__pyx_n_s___offset, __pyx_k___offset, sizeof(__pyx_k___offset), 0, 0, 1, 1}, {&__pyx_n_s__addr, __pyx_k__addr, sizeof(__pyx_k__addr), 0, 0, 1, 1}, - {&__pyx_n_s__argname, __pyx_k__argname, sizeof(__pyx_k__argname), 0, 0, 1, 1}, - {&__pyx_n_s__argtype, __pyx_k__argtype, sizeof(__pyx_k__argtype), 0, 0, 1, 1}, - {&__pyx_n_s__arguments, __pyx_k__arguments, sizeof(__pyx_k__arguments), 0, 0, 1, 1}, {&__pyx_n_s__basicConfig, __pyx_k__basicConfig, sizeof(__pyx_k__basicConfig), 0, 0, 1, 1}, - {&__pyx_n_s__build_sep, __pyx_k__build_sep, sizeof(__pyx_k__build_sep), 0, 0, 1, 1}, - {&__pyx_n_s__bytea, __pyx_k__bytea, sizeof(__pyx_k__bytea), 0, 0, 1, 1}, - {&__pyx_n_s__check_memalloc, __pyx_k__check_memalloc, sizeof(__pyx_k__check_memalloc), 0, 0, 1, 1}, - {&__pyx_n_s__concatenate, __pyx_k__concatenate, sizeof(__pyx_k__concatenate), 0, 0, 1, 1}, {&__pyx_n_s__datefmt, __pyx_k__datefmt, sizeof(__pyx_k__datefmt), 0, 0, 1, 1}, {&__pyx_n_s__dword, __pyx_k__dword, sizeof(__pyx_k__dword), 0, 0, 1, 1}, {&__pyx_n_s__eax, __pyx_k__eax, sizeof(__pyx_k__eax), 0, 0, 1, 1}, @@ -5926,65 +5852,38 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__ecx, __pyx_k__ecx, sizeof(__pyx_k__ecx), 0, 0, 1, 1}, {&__pyx_n_s__edi, __pyx_k__edi, sizeof(__pyx_k__edi), 0, 0, 1, 1}, {&__pyx_n_s__edx, __pyx_k__edx, sizeof(__pyx_k__edx), 0, 0, 1, 1}, - {&__pyx_n_s__emu_profile, __pyx_k__emu_profile, sizeof(__pyx_k__emu_profile), 0, 0, 1, 1}, - {&__pyx_n_s__emu_profile_debug, __pyx_k__emu_profile_debug, sizeof(__pyx_k__emu_profile_debug), 0, 0, 1, 1}, {&__pyx_n_s__emu_profile_output, __pyx_k__emu_profile_output, sizeof(__pyx_k__emu_profile_output), 0, 0, 1, 1}, - {&__pyx_n_s__env, __pyx_k__env, sizeof(__pyx_k__env), 0, 0, 1, 1}, {&__pyx_n_s__esi, __pyx_k__esi, sizeof(__pyx_k__esi), 0, 0, 1, 1}, {&__pyx_n_s__esp, __pyx_k__esp, sizeof(__pyx_k__esp), 0, 0, 1, 1}, - {&__pyx_n_s__fnname, __pyx_k__fnname, sizeof(__pyx_k__fnname), 0, 0, 1, 1}, {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, {&__pyx_n_s__free, __pyx_k__free, sizeof(__pyx_k__free), 0, 0, 1, 1}, - {&__pyx_n_s__functions, __pyx_k__functions, sizeof(__pyx_k__functions), 0, 0, 1, 1}, {&__pyx_n_s__hashlib, __pyx_k__hashlib, sizeof(__pyx_k__hashlib), 0, 0, 1, 1}, {&__pyx_n_s__hexdigest, __pyx_k__hexdigest, sizeof(__pyx_k__hexdigest), 0, 0, 1, 1}, - {&__pyx_n_s__hook, __pyx_k__hook, sizeof(__pyx_k__hook), 0, 0, 1, 1}, - {&__pyx_n_s__log_array_end, __pyx_k__log_array_end, sizeof(__pyx_k__log_array_end), 0, 0, 1, 1}, - {&__pyx_n_s__log_array_start, __pyx_k__log_array_start, sizeof(__pyx_k__log_array_start), 0, 0, 1, 1}, - {&__pyx_n_s__log_bracket_closed, __pyx_k__log_bracket_closed, sizeof(__pyx_k__log_bracket_closed), 0, 0, 1, 1}, - {&__pyx_n_s__log_function_header, __pyx_k__log_function_header, sizeof(__pyx_k__log_function_header), 0, 0, 1, 1}, - {&__pyx_n_s__log_struct_end, __pyx_k__log_struct_end, sizeof(__pyx_k__log_struct_end), 0, 0, 1, 1}, - {&__pyx_n_s__log_struct_start, __pyx_k__log_struct_start, sizeof(__pyx_k__log_struct_start), 0, 0, 1, 1}, {&__pyx_n_s__logging, __pyx_k__logging, sizeof(__pyx_k__logging), 0, 0, 1, 1}, {&__pyx_n_s__md5, __pyx_k__md5, sizeof(__pyx_k__md5), 0, 0, 1, 1}, {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, {&__pyx_n_s__new, __pyx_k__new, sizeof(__pyx_k__new), 0, 0, 1, 1}, {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, {&__pyx_n_s__open, __pyx_k__open, sizeof(__pyx_k__open), 0, 0, 1, 1}, - {&__pyx_n_s__output, __pyx_k__output, sizeof(__pyx_k__output), 0, 0, 1, 1}, {&__pyx_n_s__output_size, __pyx_k__output_size, sizeof(__pyx_k__output_size), 0, 0, 1, 1}, {&__pyx_n_s__prepare, __pyx_k__prepare, sizeof(__pyx_k__prepare), 0, 0, 1, 1}, - {&__pyx_n_s__profile, __pyx_k__profile, sizeof(__pyx_k__profile), 0, 0, 1, 1}, {&__pyx_n_s__property, __pyx_k__property, sizeof(__pyx_k__property), 0, 0, 1, 1}, - {&__pyx_n_s__ptr, __pyx_k__ptr, sizeof(__pyx_k__ptr), 0, 0, 1, 1}, {&__pyx_n_s__pylibemu, __pyx_k__pylibemu, sizeof(__pyx_k__pylibemu), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, {&__pyx_n_s__reg, __pyx_k__reg, sizeof(__pyx_k__reg), 0, 0, 1, 1}, - {&__pyx_n_s__render, __pyx_k__render, sizeof(__pyx_k__render), 0, 0, 1, 1}, - {&__pyx_n_s__return_value, __pyx_k__return_value, sizeof(__pyx_k__return_value), 0, 0, 1, 1}, {&__pyx_n_s__run, __pyx_k__run, sizeof(__pyx_k__run), 0, 0, 1, 1}, - {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, - {&__pyx_n_s__sep, __pyx_k__sep, sizeof(__pyx_k__sep), 0, 0, 1, 1}, {&__pyx_n_s__shellcode, __pyx_k__shellcode, sizeof(__pyx_k__shellcode), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, {&__pyx_n_s__socket, __pyx_k__socket, sizeof(__pyx_k__socket), 0, 0, 1, 1}, {&__pyx_n_s__steps, __pyx_k__steps, sizeof(__pyx_k__steps), 0, 0, 1, 1}, {&__pyx_n_s__sys, __pyx_k__sys, sizeof(__pyx_k__sys), 0, 0, 1, 1}, - {&__pyx_n_s__tchar, __pyx_k__tchar, sizeof(__pyx_k__tchar), 0, 0, 1, 1}, {&__pyx_n_s__test, __pyx_k__test, sizeof(__pyx_k__test), 0, 0, 1, 1}, {&__pyx_n_s__timeout, __pyx_k__timeout, sizeof(__pyx_k__timeout), 0, 0, 1, 1}, - {&__pyx_n_s__tint, __pyx_k__tint, sizeof(__pyx_k__tint), 0, 0, 1, 1}, - {&__pyx_n_s__tptr, __pyx_k__tptr, sizeof(__pyx_k__tptr), 0, 0, 1, 1}, - {&__pyx_n_s__truncate, __pyx_k__truncate, sizeof(__pyx_k__truncate), 0, 0, 1, 1}, - {&__pyx_n_s__tstruct, __pyx_k__tstruct, sizeof(__pyx_k__tstruct), 0, 0, 1, 1}, {&__pyx_n_s__urllib2, __pyx_k__urllib2, sizeof(__pyx_k__urllib2), 0, 0, 1, 1}, {&__pyx_n_s__urlopen, __pyx_k__urlopen, sizeof(__pyx_k__urlopen), 0, 0, 1, 1}, {&__pyx_n_s__val, __pyx_k__val, sizeof(__pyx_k__val), 0, 0, 1, 1}, - {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, {&__pyx_n_s__warning, __pyx_k__warning, sizeof(__pyx_k__warning), 0, 0, 1, 1}, {&__pyx_n_s__wb, __pyx_k__wb, sizeof(__pyx_k__wb), 0, 0, 1, 1}, - {&__pyx_n_s__win, __pyx_k__win, sizeof(__pyx_k__win), 0, 0, 1, 1}, {&__pyx_n_s__write, __pyx_k__write, sizeof(__pyx_k__write), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; @@ -5998,6 +5897,7 @@ static int __Pyx_InitCachedBuiltins(void) { } static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); /* "pylibemu.pyx":68 @@ -6083,12 +5983,12 @@ static int __Pyx_InitCachedConstants(void) { * * if ret == -1: */ - __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40)); + __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28)); __Pyx_INCREF(((PyObject *)__pyx_n_s__Error)); - PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_n_s__Error)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_n_s__Error)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Error)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_40)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -6126,8 +6026,8 @@ PyMODINIT_FUNC PyInit_pylibemu(void) PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -6135,8 +6035,9 @@ PyMODINIT_FUNC PyInit_pylibemu(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_pylibemu(void)", __LINE__, __FILE__); #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_pylibemu(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __pyx_binding_PyCFunctionType_USED @@ -6172,6 +6073,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_8pylibemu_EmuProfile = &__pyx_vtable_8pylibemu_EmuProfile; @@ -6209,8 +6111,9 @@ PyMODINIT_FUNC PyInit_pylibemu(void) if (__Pyx_SetAttrString(__pyx_m, "Emulator", (PyObject *)&__pyx_type_8pylibemu_Emulator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8pylibemu_Emulator = &__pyx_type_8pylibemu_Emulator; /*--- Type import code ---*/ - __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -6221,7 +6124,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) * import socket * import urllib2 */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__sys), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6233,7 +6136,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) * import urllib2 * import hashlib */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__socket), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__socket), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__socket, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6245,7 +6148,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) * import hashlib * import logging */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__urllib2), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__urllib2), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__urllib2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6257,7 +6160,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) * import logging * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__hashlib), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__hashlib), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hashlib, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6269,7 +6172,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) * * logging.basicConfig(format = '%(asctime)s %(message)s', datefmt='[%Y-%m-%d %H:%M:%S]') */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__logging), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6288,8 +6191,8 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__format), ((PyObject *)__pyx_kp_s_42)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__datefmt), ((PyObject *)__pyx_kp_s_43)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__format), ((PyObject *)__pyx_kp_s_30)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__datefmt), ((PyObject *)__pyx_kp_s_31)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -6440,7 +6343,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) * return self.emu_profile.truncate * */ - __pyx_t_3 = __Pyx_GetName((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_44); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); @@ -6450,7 +6353,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __pyx_t_3 = PyObject_Call(__pyx_builtin_property, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8pylibemu_Emulator->tp_dict, __pyx_n_s_44, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8pylibemu_Emulator->tp_dict, __pyx_n_s_32, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_8pylibemu_Emulator); @@ -6463,20 +6366,13 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - - /* "cpython/type.pxd":2 - * - * cdef extern from "Python.h": # <<<<<<<<<<<<<< - * # The C structure of the objects used to describe built-in types. - * - */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { - __Pyx_AddTraceback("init pylibemu"); + __Pyx_AddTraceback("init pylibemu", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init pylibemu"); @@ -6492,11 +6388,34 @@ PyMODINIT_FUNC PyInit_pylibemu(void) /* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } return result; } @@ -6546,33 +6465,6 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) } -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) @@ -6673,7 +6565,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; @@ -6685,14 +6577,10 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", - #else - "%s() takes %s %zd positional argument%s (%zd given)", - #endif - func_name, more_or_less, num_expected, number, num_found); + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); } static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { @@ -6719,7 +6607,7 @@ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) Py_XDECREF(tmp_tb); } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; @@ -6743,8 +6631,23 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); @@ -6758,7 +6661,7 @@ static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases) { #if PY_MAJOR_VERSION < 3 if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { PyObject *base = PyTuple_GET_ITEM(bases, 0); - metaclass = PyObject_GetAttrString(base, "__class__"); + metaclass = PyObject_GetAttrString(base, (char *)"__class__"); if (!metaclass) { PyErr_Clear(); metaclass = (PyObject*) Py_TYPE(base); @@ -6798,6 +6701,33 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na return result; } +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t val) { const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0; const int is_unsigned = const_zero < neg_one; @@ -6818,7 +6748,7 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t val) { } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(int32_t), + return _PyLong_FromByteArray(bytes, sizeof(int32_t), little, !is_unsigned); } } @@ -7275,9 +7205,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -7310,9 +7240,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -7345,9 +7275,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -7380,9 +7310,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -7415,9 +7345,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -7450,9 +7380,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -7464,7 +7394,8 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name) { +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); @@ -7482,6 +7413,25 @@ static void __Pyx_WriteUnraisable(const char *name) { } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) PyObject *ob = PyCapsule_New(vtable, 0, 0); @@ -7502,7 +7452,7 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; @@ -7532,17 +7482,17 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 - PyErr_Warn(NULL, warning); + if (PyErr_Warn(NULL, warning) < 0) goto bad; #else - PyErr_WarnEx(NULL, warning, 0); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { + else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -7552,7 +7502,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif @@ -7582,7 +7532,8 @@ static PyObject *__Pyx_ImportModule(const char *name) { #include "frameobject.h" #include "traceback.h" -static void __Pyx_AddTraceback(const char *funcname) { +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; diff --git a/src/pylibemu.pxd b/src/pylibemu.pxd index f6feb76..d094354 100644 --- a/src/pylibemu.pxd +++ b/src/pylibemu.pxd @@ -1,6 +1,6 @@ # pylibemu.pxd # -# Copyright(c) 2011 Angelo Dell'Aera +# Copyright(c) 2011-2012 Angelo Dell'Aera # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as diff --git a/src/pylibemu.pyx b/src/pylibemu.pyx index 853d7b4..6f785f8 100644 --- a/src/pylibemu.pyx +++ b/src/pylibemu.pyx @@ -1,7 +1,7 @@ # # pylibemu.pyx # -# Copyright(c) 2011 Angelo Dell'Aera +# Copyright(c) 2011-2012 Angelo Dell'Aera # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as From b32cdd59e5009f40f9f6639a2b336ae0e15eef48 Mon Sep 17 00:00:00 2001 From: Angelo Dell'Aera Date: Thu, 5 Apr 2012 14:50:03 +0200 Subject: [PATCH 2/4] Version 0.1.5 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2226f92..0ebab15 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name = "pylibemu", packages = [], - version = "0.1.4", + version = "0.1.5", description = "Libemu Python wrapper", url = "", author = "Angelo Dell'Aera", From e195f853027eb581b5032d2ff4dc44852e2e823f Mon Sep 17 00:00:00 2001 From: Angelo Dell'Aera Date: Thu, 5 Apr 2012 14:59:50 +0200 Subject: [PATCH 3/4] Minor change --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 6fc8d14..d445865 100644 --- a/README +++ b/README @@ -167,7 +167,7 @@ method and subsequently run the shellcode emulation test again as shown above. License information =================== -Copyright (C) 2011 Angelo Dell'Aera +Copyright (C) 2011-2012 Angelo Dell'Aera License: GNU General Public License, version 2 or later; see COPYING.txt included in this archive for details. From 62d227044a1360e564f8e2ef74350c40ea7f8661 Mon Sep 17 00:00:00 2001 From: Angelo Dell'Aera Date: Fri, 4 May 2012 10:10:03 +0200 Subject: [PATCH 4/4] Added Emulator cpu_eip_get method --- src/pylibemu.c | 1435 +++++++++++++++++++++++++++++++--------------- src/pylibemu.pyx | 15 +- 2 files changed, 985 insertions(+), 465 deletions(-) diff --git a/src/pylibemu.c b/src/pylibemu.c index ed1214c..d3b9645 100644 --- a/src/pylibemu.c +++ b/src/pylibemu.c @@ -1,11 +1,12 @@ -/* Generated by Cython 0.15.1 on Thu Apr 5 14:46:08 2012 */ +/* Generated by Cython 0.16 on Fri May 4 10:07:53 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -34,10 +35,22 @@ #define PY_LONG_LONG LONG_LONG #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif + +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif + +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyCFunction_Call PyObject_Call +#else + #define __Pyx_PyCFunction_Call PyCFunction_Call #endif #if PY_VERSION_HEX < 0x02050000 @@ -50,6 +63,9 @@ #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" #endif #if PY_VERSION_HEX < 0x02060000 @@ -83,13 +99,25 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif + +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 @@ -101,6 +129,17 @@ #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) +#endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -168,15 +207,6 @@ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -218,6 +248,14 @@ #define __Pyx_DOCSTR(n) (n) #endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -280,7 +318,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -305,7 +343,7 @@ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -439,11 +477,9 @@ struct __pyx_vtabstruct_8pylibemu_Emulator { int (*run)(struct __pyx_obj_8pylibemu_Emulator *, PyObject *, int __pyx_skip_dispatch); }; static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emulator; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -456,8 +492,21 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -468,7 +517,7 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -479,15 +528,18 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ @@ -507,6 +559,8 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE uint16_t __Pyx_PyInt_from_py_uint16_t(PyObject *); + static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t); static CYTHON_INLINE uint32_t __Pyx_PyInt_from_py_uint32_t(PyObject *); @@ -521,6 +575,8 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject *); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t); + static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -560,15 +616,38 @@ static int __Pyx_check_binary_version(void); static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + /* Module declarations from 'libc.stdint' */ /* Module declarations from 'cpython.version' */ @@ -660,6 +739,22 @@ int __pyx_module_is_main_pylibemu = 0; static PyObject *__pyx_builtin_property; static PyObject *__pyx_builtin_open; static PyObject *__pyx_builtin_range; +static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, size_t __pyx_v_output_size); /* proto */ +static int __pyx_pf_8pylibemu_8Emulator___cinit__(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_output_size); /* proto */ +static void __pyx_pf_8pylibemu_8Emulator_2__dealloc__(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_4free(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_6new(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_output_size); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode, PyObject *__pyx_v_offset); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_14test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_steps); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_16run(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_18offset(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_20emu_profile_output(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_22emu_profile_truncated(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_24memory_write_dword(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_addr, PyObject *__pyx_v_dword); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg32_set(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_reg, PyObject *__pyx_v_val); /* proto */ +static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_eip_get(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self); /* proto */ static char __pyx_k_1[] = "Downloading %s (%s)"; static char __pyx_k_2[] = "Error while downloading from %s"; static char __pyx_k_4[] = "Memory allocation error"; @@ -822,13 +917,13 @@ static PyObject *__pyx_k_tuple_28; * cdef void *pCaller */ -static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { +static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env *__pyx_v_env, struct emu_env_hook *__pyx_v_hook, ...) { va_list __pyx_v_args; - void *__pyx_v_pCaller; + CYTHON_UNUSED void *__pyx_v_pCaller; char *__pyx_v_szURL; char *__pyx_v_szFileName; - int __pyx_v_dwReserved; - void *__pyx_v_lpfnCB; + CYTHON_UNUSED int __pyx_v_dwReserved; + CYTHON_UNUSED void *__pyx_v_lpfnCB; PyObject *__pyx_v_url = NULL; PyObject *__pyx_v_content = NULL; PyObject *__pyx_v_m = NULL; @@ -851,7 +946,7 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("URLDownloadToFile"); + __Pyx_RefNannySetupContext("URLDownloadToFile", 0); /* "pylibemu.pyx":51 * cdef void *p @@ -933,7 +1028,7 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __pyx_t_3 = PyBytes_FromString(__pyx_v_szFileName); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_3)); @@ -944,7 +1039,7 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -983,14 +1078,14 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __pyx_t_3 = PyBytes_FromString(__pyx_v_szURL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__timeout), __pyx_int_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -1052,7 +1147,7 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __pyx_t_4 = PyBytes_FromString(__pyx_v_szURL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -1060,7 +1155,7 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -1120,7 +1215,7 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_content); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_content); __Pyx_GIVEREF(__pyx_v_content); @@ -1145,7 +1240,7 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; @@ -1153,14 +1248,14 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__mode), ((PyObject *)__pyx_n_s__wb)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_builtin_open, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_open, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -1168,10 +1263,10 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __Pyx_GOTREF(__pyx_t_7); __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____enter__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L13_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L13_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*try:*/ { { __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_5, &__pyx_t_10); @@ -1179,8 +1274,9 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __Pyx_XGOTREF(__pyx_t_5); __Pyx_XGOTREF(__pyx_t_10); /*try:*/ { - __pyx_v_fd = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_INCREF(__pyx_t_3); + __pyx_v_fd = __pyx_t_3; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pylibemu.pyx":69 * m = hashlib.md5(content) @@ -1189,18 +1285,18 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, * * return 0 */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_fd, __pyx_n_s__write); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_fd, __pyx_n_s__write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L17_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_content); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_content); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_content); __Pyx_GIVEREF(__pyx_v_content); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -1210,9 +1306,9 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pylibemu.pyx":68 * @@ -1223,21 +1319,21 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, */ /*except:*/ { __Pyx_AddTraceback("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_2, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_INCREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_12 = PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} @@ -1247,19 +1343,19 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} __pyx_t_13 = (!__pyx_t_11); if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_ErrRestore(__pyx_t_3, __pyx_t_2, __pyx_t_1); - __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_3); + __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - goto __pyx_L27; + goto __pyx_L28; } - __pyx_L27:; + __pyx_L28:; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L18_exception_handled; } __pyx_L19_except_error:; @@ -1287,11 +1383,11 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } - goto __pyx_L28; + goto __pyx_L29; __pyx_L13_error:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L1_error; - __pyx_L28:; + __pyx_L29:; } /* "pylibemu.pyx":71 @@ -1324,43 +1420,33 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(struct emu_env *__pyx_v_env, return __pyx_r; } -/* "pylibemu.pyx":87 - * cdef int output_size - * - * def __cinit__(self, size_t output_size): # <<<<<<<<<<<<<< - * self.truncate = False - * self.output_size = output_size - */ - -static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_8pylibemu_10EmuProfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_8pylibemu_10EmuProfile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { size_t __pyx_v_output_size; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__output_size,0}; int __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__output_size,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { PyObject* values[1] = {0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output_size); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -1377,6 +1463,27 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_10EmuProfile___cinit__(((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self), __pyx_v_output_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pylibemu.pyx":87 + * cdef int output_size + * + * def __cinit__(self, size_t output_size): # <<<<<<<<<<<<<< + * self.truncate = False + * self.output_size = output_size + */ + +static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, size_t __pyx_v_output_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); /* "pylibemu.pyx":88 * @@ -1385,7 +1492,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO * self.output_size = output_size * */ - ((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)->truncate = 0; + __pyx_v_self->truncate = 0; /* "pylibemu.pyx":89 * def __cinit__(self, size_t output_size): @@ -1394,7 +1501,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO * * self.output = malloc(output_size) */ - ((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)->output_size = __pyx_v_output_size; + __pyx_v_self->output_size = __pyx_v_output_size; /* "pylibemu.pyx":91 * self.output_size = output_size @@ -1403,7 +1510,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO * self.s = malloc(S_SIZE) * */ - ((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)->output = ((char *)malloc(__pyx_v_output_size)); + __pyx_v_self->output = ((char *)malloc(__pyx_v_output_size)); /* "pylibemu.pyx":92 * @@ -1412,7 +1519,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO * * self.check_memalloc() */ - ((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)->s = ((char *)malloc(4096)); + __pyx_v_self->s = ((char *)malloc(4096)); /* "pylibemu.pyx":94 * self.s = malloc(S_SIZE) @@ -1421,7 +1528,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO * memset(self.output, 0, output_size) * memset(self.s , 0, S_SIZE) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)->__pyx_vtab)->check_memalloc(((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->check_memalloc(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -1432,7 +1539,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO * memset(self.s , 0, S_SIZE) * self.build_sep() */ - memset(((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)->output, 0, __pyx_v_output_size); + memset(__pyx_v_self->output, 0, __pyx_v_output_size); /* "pylibemu.pyx":96 * self.check_memalloc() @@ -1441,7 +1548,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO * self.build_sep() * */ - memset(((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)->s, 0, 4096); + memset(__pyx_v_self->s, 0, 4096); /* "pylibemu.pyx":97 * memset(self.output, 0, output_size) @@ -1450,7 +1557,7 @@ static int __pyx_pf_8pylibemu_10EmuProfile___cinit__(PyObject *__pyx_v_self, PyO * * cdef check_memalloc(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)->__pyx_vtab)->build_sep(((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->__pyx_vtab)->build_sep(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -1484,7 +1591,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("check_memalloc"); + __Pyx_RefNannySetupContext("check_memalloc", 0); /* "pylibemu.pyx":100 * @@ -1566,7 +1673,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8py size_t __pyx_t_1; size_t __pyx_t_2; int __pyx_t_3; - __Pyx_RefNannySetupContext("concatenate"); + __Pyx_RefNannySetupContext("concatenate", 0); /* "pylibemu.pyx":105 * @@ -1666,7 +1773,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pyli int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("build_sep"); + __Pyx_RefNannySetupContext("build_sep", 0); /* "pylibemu.pyx":115 * @@ -1840,7 +1947,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_function_header(struct __pyx int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_function_header"); + __Pyx_RefNannySetupContext("log_function_header", 0); /* "pylibemu.pyx":143 * "%s %s (\n", @@ -1890,7 +1997,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed(struct __pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_bracket_closed"); + __Pyx_RefNannySetupContext("log_bracket_closed", 0); /* "pylibemu.pyx":148 * @@ -1939,7 +2046,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_obj int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_array_start"); + __Pyx_RefNannySetupContext("log_array_start", 0); /* "pylibemu.pyx":158 * self.sep[indent], @@ -1981,14 +2088,14 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_obj * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, CYTHON_UNUSED struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_array_end"); + __Pyx_RefNannySetupContext("log_array_end", 0); /* "pylibemu.pyx":166 * S_SIZE, @@ -2037,7 +2144,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_ob int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_struct_start"); + __Pyx_RefNannySetupContext("log_struct_start", 0); /* "pylibemu.pyx":176 * self.sep[indent], @@ -2079,14 +2186,14 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_ob * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, CYTHON_UNUSED struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("log_struct_end"); + __Pyx_RefNannySetupContext("log_struct_end", 0); /* "pylibemu.pyx":184 * S_SIZE, @@ -2135,7 +2242,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_int"); + __Pyx_RefNannySetupContext("emu_profile_argument_render_int", 0); /* "pylibemu.pyx":195 * argument.argtype, @@ -2184,7 +2291,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_stri int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_string"); + __Pyx_RefNannySetupContext("emu_profile_argument_render_string", 0); /* "pylibemu.pyx":206 * argument.argtype, @@ -2233,7 +2340,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_byte int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_bytea"); + __Pyx_RefNannySetupContext("emu_profile_argument_render_bytea", 0); /* "pylibemu.pyx":217 * argument.argtype, @@ -2282,7 +2389,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_ptr"); + __Pyx_RefNannySetupContext("emu_profile_argument_render_ptr", 0); /* "pylibemu.pyx":222 * @@ -2356,7 +2463,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip(s int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_ip"); + __Pyx_RefNannySetupContext("emu_profile_argument_render_ip", 0); /* "pylibemu.pyx":245 * cdef char *host @@ -2424,7 +2531,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_port"); + __Pyx_RefNannySetupContext("emu_profile_argument_render_port", 0); /* "pylibemu.pyx":262 * cdef uint16_t port @@ -2475,14 +2582,14 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port * S_SIZE, */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, CYTHON_UNUSED struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_render_none"); + __Pyx_RefNannySetupContext("emu_profile_argument_render_none", 0); /* "pylibemu.pyx":279 * S_SIZE, @@ -2524,10 +2631,10 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none * */ -static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none(CYTHON_UNUSED struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("emu_profile_function_render_none"); + __Pyx_RefNannySetupContext("emu_profile_function_render_none", 0); /* "pylibemu.pyx":284 * @@ -2562,7 +2669,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_function_render_int"); + __Pyx_RefNannySetupContext("emu_profile_function_render_int", 0); /* "pylibemu.pyx":290 * S_SIZE, @@ -2611,7 +2718,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr( int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_function_render_ptr"); + __Pyx_RefNannySetupContext("emu_profile_function_render_ptr", 0); /* "pylibemu.pyx":298 * S_SIZE, @@ -2664,7 +2771,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struc int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_argument_debug"); + __Pyx_RefNannySetupContext("emu_profile_argument_debug", 0); /* "pylibemu.pyx":307 * cdef int is_struct @@ -3225,7 +3332,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struc int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_function_debug"); + __Pyx_RefNannySetupContext("emu_profile_function_debug", 0); /* "pylibemu.pyx":373 * @@ -3452,7 +3559,7 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_o int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_debug"); + __Pyx_RefNannySetupContext("emu_profile_debug", 0); /* "pylibemu.pyx":398 * @@ -3507,39 +3614,27 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":411 - * cdef size_t output_size - * - * def __cinit__(self, output_size = OUTPUT_SIZE): # <<<<<<<<<<<<<< - * self.output_size = output_size - * self.new() - */ - -static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static int __pyx_pw_8pylibemu_8Emulator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_8pylibemu_8Emulator_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_output_size = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__output_size,0}; int __pyx_r; __Pyx_RefNannyDeclarations - size_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__output_size,0}; - __Pyx_RefNannySetupContext("__cinit__"); + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { PyObject* values[1] = {0}; values[0] = ((PyObject *)__pyx_int_1048576); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__output_size); @@ -3547,7 +3642,7 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObje } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3566,6 +3661,29 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObje __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_8Emulator___cinit__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_output_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pylibemu.pyx":411 + * cdef size_t output_size + * + * def __cinit__(self, output_size = OUTPUT_SIZE): # <<<<<<<<<<<<<< + * self.output_size = output_size + * self.new() + */ + +static int __pyx_pf_8pylibemu_8Emulator___cinit__(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_output_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + size_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); /* "pylibemu.pyx":412 * @@ -3575,7 +3693,7 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObje * */ __pyx_t_1 = __Pyx_PyInt_AsSize_t(__pyx_v_output_size); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->output_size = __pyx_t_1; + __pyx_v_self->output_size = __pyx_t_1; /* "pylibemu.pyx":413 * def __cinit__(self, output_size = OUTPUT_SIZE): @@ -3584,7 +3702,7 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObje * * def __dealloc__(self): */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -3603,6 +3721,15 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObje return __pyx_r; } +/* Python wrapper */ +static void __pyx_pw_8pylibemu_8Emulator_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ +static void __pyx_pw_8pylibemu_8Emulator_3__dealloc__(PyObject *__pyx_v_self) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); + __pyx_pf_8pylibemu_8Emulator_2__dealloc__(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); +} + /* "pylibemu.pyx":415 * self.new() * @@ -3611,15 +3738,14 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(PyObject *__pyx_v_self, PyObje * */ -static void __pyx_pf_8pylibemu_8Emulator_1__dealloc__(PyObject *__pyx_v_self); /*proto*/ -static void __pyx_pf_8pylibemu_8Emulator_1__dealloc__(PyObject *__pyx_v_self) { +static void __pyx_pf_8pylibemu_8Emulator_2__dealloc__(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self) { __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_RefNannySetupContext("__dealloc__", 0); /* "pylibemu.pyx":416 * @@ -3628,7 +3754,7 @@ static void __pyx_pf_8pylibemu_8Emulator_1__dealloc__(PyObject *__pyx_v_self) { * * def free(self): */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__free); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__free); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -3644,6 +3770,17 @@ static void __pyx_pf_8pylibemu_8Emulator_1__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyFinishContext(); } +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_5free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_5free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("free (wrapper)", 0); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_4free(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "pylibemu.pyx":418 * self.free() * @@ -3652,12 +3789,11 @@ static void __pyx_pf_8pylibemu_8Emulator_1__dealloc__(PyObject *__pyx_v_self) { * emu_free(self._emu) */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8pylibemu_8Emulator_4free(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("free"); + __Pyx_RefNannySetupContext("free", 0); /* "pylibemu.pyx":419 * @@ -3666,7 +3802,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTH * emu_free(self._emu) * self._emu = NULL */ - __pyx_t_1 = (((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu != NULL); + __pyx_t_1 = (__pyx_v_self->_emu != NULL); if (__pyx_t_1) { /* "pylibemu.pyx":420 @@ -3676,7 +3812,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTH * self._emu = NULL * */ - emu_free(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu); + emu_free(__pyx_v_self->_emu); /* "pylibemu.pyx":421 * if self._emu is not NULL: @@ -3685,10 +3821,10 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTH * * def new(self): */ - ((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu = NULL; - goto __pyx_L5; + __pyx_v_self->_emu = NULL; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); @@ -3696,6 +3832,17 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTH return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_7new(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_7new(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("new (wrapper)", 0); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_6new(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "pylibemu.pyx":423 * self._emu = NULL * @@ -3704,8 +3851,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_2free(PyObject *__pyx_v_self, CYTH * self.emu_profile = EmuProfile(self.output_size) */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8pylibemu_8Emulator_6new(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3713,7 +3859,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHO int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("new"); + __Pyx_RefNannySetupContext("new", 0); /* "pylibemu.pyx":424 * @@ -3722,7 +3868,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHO * self.emu_profile = EmuProfile(self.output_size) * */ - ((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu = emu_new(); + __pyx_v_self->_emu = emu_new(); /* "pylibemu.pyx":425 * def new(self): @@ -3731,10 +3877,10 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHO * * def set_output_size(self, output_size): */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->output_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_self->output_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3742,9 +3888,9 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHO __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); - __Pyx_GOTREF(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->emu_profile); - __Pyx_DECREF(((PyObject *)((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->emu_profile)); - ((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->emu_profile = ((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->emu_profile); + __Pyx_DECREF(((PyObject *)__pyx_v_self->emu_profile)); + __pyx_v_self->emu_profile = ((struct __pyx_obj_8pylibemu_EmuProfile *)__pyx_t_1); __pyx_t_1 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -3760,6 +3906,17 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHO return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_9set_output_size(PyObject *__pyx_v_self, PyObject *__pyx_v_output_size); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_9set_output_size(PyObject *__pyx_v_self, PyObject *__pyx_v_output_size) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_output_size (wrapper)", 0); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_8set_output_size(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((PyObject *)__pyx_v_output_size)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "pylibemu.pyx":427 * self.emu_profile = EmuProfile(self.output_size) * @@ -3768,8 +3925,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_3new(PyObject *__pyx_v_self, CYTHO * self.output_size = output_size */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v_self, PyObject *__pyx_v_output_size); /*proto*/ -static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v_self, PyObject *__pyx_v_output_size) { +static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_output_size) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3778,7 +3934,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("set_output_size"); + __Pyx_RefNannySetupContext("set_output_size", 0); /* "pylibemu.pyx":428 * @@ -3787,7 +3943,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v * self.output_size = output_size * self.new() */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__free); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__free); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -3802,7 +3958,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v * */ __pyx_t_3 = __Pyx_PyInt_AsSize_t(__pyx_v_output_size); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - ((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->output_size = __pyx_t_3; + __pyx_v_self->output_size = __pyx_t_3; /* "pylibemu.pyx":430 * self.free() @@ -3811,7 +3967,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v * * def shellcode_getpc_test(self, shellcode): */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -3831,6 +3987,18 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode); /*proto*/ +static char __pyx_doc_8pylibemu_8Emulator_10shellcode_getpc_test[] = "\n GetPC code is code that determines its own location in a process address\n space. It is commonly used in code that needs to reference itself, for\n instance in self-decoding and self-modifying code. This method tries to\n identify GetPC within the shellcode.\n\n @type shellcode: Binary string\n @param shellcode: Shellcode\n\n @rtype: Integer\n @return: If GetPC code is successfully identified the offset from the\n start of the shellcode is returned, otherwise -1.\n "; +static PyObject *__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("shellcode_getpc_test (wrapper)", 0); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((PyObject *)__pyx_v_shellcode)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "pylibemu.pyx":432 * self.new() * @@ -3839,11 +4007,9 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_4set_output_size(PyObject *__pyx_v * GetPC code is code that determines its own location in a process address */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_5shellcode_getpc_test[] = "\n GetPC code is code that determines its own location in a process address\n space. It is commonly used in code that needs to reference itself, for\n instance in self-decoding and self-modifying code. This method tries to\n identify GetPC within the shellcode.\n\n @type shellcode: Binary string\n @param shellcode: Shellcode\n\n @rtype: Integer\n @return: If GetPC code is successfully identified the offset from the\n start of the shellcode is returned, otherwise -1.\n "; -static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode) { +static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode) { char *__pyx_v_buffer; - Py_ssize_t __pyx_v_sclen; + PyObject *__pyx_v_sclen = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3851,10 +4017,11 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ PyObject *__pyx_t_3 = NULL; char *__pyx_t_4; Py_ssize_t __pyx_t_5; + uint16_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("shellcode_getpc_test"); + __Pyx_RefNannySetupContext("shellcode_getpc_test", 0); /* "pylibemu.pyx":448 * cdef char *buffer @@ -3863,7 +4030,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ * self.new() * */ - __pyx_t_1 = (((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu == NULL); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (__pyx_t_1) { /* "pylibemu.pyx":449 @@ -3873,15 +4040,15 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ * * buffer = shellcode */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; /* "pylibemu.pyx":451 * self.new() @@ -3901,7 +4068,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ * if buffer is NULL: */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_shellcode); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_shellcode); __Pyx_GIVEREF(__pyx_v_shellcode); @@ -3910,7 +4077,10 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_5 = PyBytes_GET_SIZE(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_sclen = __pyx_t_5; + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_sclen = __pyx_t_2; + __pyx_t_2 = 0; /* "pylibemu.pyx":454 * sclen = len(bytes(shellcode)) @@ -3933,9 +4103,9 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ __Pyx_INCREF(__pyx_int_neg_1); __pyx_r = __pyx_int_neg_1; goto __pyx_L0; - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; /* "pylibemu.pyx":457 * return -1 @@ -3944,7 +4114,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ * return self._offset * */ - ((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_offset = emu_shellcode_test(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu, ((uint8_t *)__pyx_v_buffer), __pyx_v_sclen); + __pyx_t_6 = __Pyx_PyInt_from_py_uint16_t(__pyx_v_sclen); if (unlikely((__pyx_t_6 == (uint16_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->_offset = emu_shellcode_test(__pyx_v_self->_emu, ((uint8_t *)__pyx_v_buffer), __pyx_t_6); /* "pylibemu.pyx":458 * @@ -3954,7 +4125,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ * def prepare(self, shellcode, offset): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -3968,55 +4139,35 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test(PyObject *__ __Pyx_AddTraceback("pylibemu.Emulator.shellcode_getpc_test", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_sclen); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "pylibemu.pyx":460 - * return self._offset - * - * def prepare(self, shellcode, offset): # <<<<<<<<<<<<<< - * ''' - * Method used to prepare the execution environment. The offset parameter - */ - -static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_6prepare[] = "\n Method used to prepare the execution environment. The offset parameter\n value should be determined by the `shellcode_getpc_test method'. If such\n method is not able to identify the GetPC code (thus returning -1) the\n suggested value for offset parameter is 0.\n\n @type shellcode: Binary string\n @param shellcode: Shellcode\n @type offset : Integer\n @param offset : GetPC offset\n "; -static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_13prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8pylibemu_8Emulator_12prepare[] = "\n Method used to prepare the execution environment. The offset parameter\n value should be determined by the `shellcode_getpc_test method'. If such\n method is not able to identify the GetPC code (thus returning -1) the\n suggested value for offset parameter is 0.\n\n @type shellcode: Binary string\n @param shellcode: Shellcode\n @type offset : Integer\n @param offset : GetPC offset\n "; +static PyObject *__pyx_pw_8pylibemu_8Emulator_13prepare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_shellcode = 0; PyObject *__pyx_v_offset = 0; - struct emu_cpu *__pyx_v__cpu; - struct emu_memory *__pyx_v__mem; - char *__pyx_v_scode; - int __pyx_v_j; - int __pyx_v_static_offset; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - char *__pyx_t_5; - Py_ssize_t __pyx_t_6; - uint32_t __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__shellcode,&__pyx_n_s__offset,0}; - __Pyx_RefNannySetupContext("prepare"); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("prepare (wrapper)", 0); { PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__shellcode); if (likely(values[0])) kw_args--; @@ -4029,7 +4180,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "prepare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "prepare") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4048,6 +4199,38 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_8Emulator_12prepare(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_shellcode, __pyx_v_offset); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pylibemu.pyx":460 + * return self._offset + * + * def prepare(self, shellcode, offset): # <<<<<<<<<<<<<< + * ''' + * Method used to prepare the execution environment. The offset parameter + */ + +static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode, PyObject *__pyx_v_offset) { + struct emu_cpu *__pyx_v__cpu; + struct emu_memory *__pyx_v__mem; + char *__pyx_v_scode; + int __pyx_v_j; + int __pyx_v_static_offset; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + char *__pyx_t_5; + Py_ssize_t __pyx_t_6; + uint32_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("prepare", 0); /* "pylibemu.pyx":477 * cdef int j, static_offset @@ -4056,7 +4239,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P * self.new() * */ - __pyx_t_1 = (((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu == NULL); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (__pyx_t_1) { /* "pylibemu.pyx":478 @@ -4066,15 +4249,15 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; /* "pylibemu.pyx":480 * self.new() @@ -4083,7 +4266,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P * _mem = emu_memory_get(self._emu) * */ - __pyx_v__cpu = emu_cpu_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu); + __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); /* "pylibemu.pyx":481 * @@ -4092,7 +4275,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P * * for j in range(8): */ - __pyx_v__mem = emu_memory_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu); + __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); /* "pylibemu.pyx":483 * _mem = emu_memory_get(self._emu) @@ -4247,7 +4430,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyInt_from_py_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_7 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - emu_cpu_eip_set(emu_cpu_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu), __pyx_t_7); + emu_cpu_eip_set(emu_cpu_get(__pyx_v_self->_emu), __pyx_t_7); /* "pylibemu.pyx":507 * emu_cpu_eip_set(emu_cpu_get(self._emu), static_offset + offset) @@ -4266,7 +4449,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P * * cpdef int test(self, steps = 1000000): */ - emu_cpu_reg32_set(emu_cpu_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu), esp, 0x0012fe98); + emu_cpu_reg32_set(emu_cpu_get(__pyx_v_self->_emu), esp, 0x0012fe98); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -4289,14 +4472,14 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_6prepare(PyObject *__pyx_v_self, P * Method used to test and emulate the shellcode. The method must be always */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_test *__pyx_optional_args) { PyObject *__pyx_v_steps = ((PyObject *)__pyx_int_1000000); struct emu_cpu *__pyx_v__cpu; struct emu_memory *__pyx_v__mem; struct emu_env *__pyx_v__env; - uint32_t __pyx_v_eipsave; - int __pyx_v_j; + CYTHON_UNUSED uint32_t __pyx_v_eipsave; + CYTHON_UNUSED int __pyx_v_j; int __pyx_v_ret; struct emu_env_hook *__pyx_v_hook; int __pyx_r; @@ -4310,7 +4493,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("test"); + __Pyx_RefNannySetupContext("test", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_steps = __pyx_optional_args->steps; @@ -4322,9 +4505,9 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__test); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8pylibemu_8Emulator_7test)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pylibemu_8Emulator_15test)) { __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_steps); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_steps); __Pyx_GIVEREF(__pyx_v_steps); @@ -4583,7 +4766,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __pyx_t_1 = PyBytes_FromString(__pyx_v_hook->hook.win->fnname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -4591,7 +4774,7 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -4757,40 +4940,28 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator return __pyx_r; } -/* "pylibemu.pyx":510 - * emu_cpu_reg32_set(emu_cpu_get(self._emu), esp, 0x0012fe98) - * - * cpdef int test(self, steps = 1000000): # <<<<<<<<<<<<<< - * ''' - * Method used to test and emulate the shellcode. The method must be always - */ - -static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_8pylibemu_8Emulator_7test[] = "\n Method used to test and emulate the shellcode. The method must be always\n called after the `prepare' method.\n\n @type steps: Integer\n @param steps: Max number of steps to run\n "; -static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_8pylibemu_8Emulator_14test[] = "\n Method used to test and emulate the shellcode. The method must be always\n called after the `prepare' method.\n\n @type steps: Integer\n @param steps: Max number of steps to run\n "; +static PyObject *__pyx_pw_8pylibemu_8Emulator_15test(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_steps = 0; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - struct __pyx_opt_args_8pylibemu_8Emulator_test __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__steps,0}; - __Pyx_RefNannySetupContext("test"); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("test (wrapper)", 0); { PyObject* values[1] = {0}; values[0] = ((PyObject *)__pyx_int_1000000); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__steps); @@ -4798,7 +4969,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyOb } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "test") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "test") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4817,10 +4988,33 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyOb __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_8Emulator_14test(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_steps); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pylibemu.pyx":510 + * emu_cpu_reg32_set(emu_cpu_get(self._emu), esp, 0x0012fe98) + * + * cpdef int test(self, steps = 1000000): # <<<<<<<<<<<<<< + * ''' + * Method used to test and emulate the shellcode. The method must be always + */ + +static PyObject *__pyx_pf_8pylibemu_8Emulator_14test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_steps) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + struct __pyx_opt_args_8pylibemu_8Emulator_test __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("test", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.steps = __pyx_v_steps; - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->__pyx_vtab)->test(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), 1, &__pyx_t_2); + __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->test(__pyx_v_self, 1, &__pyx_t_2); __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; @@ -4847,7 +5041,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_7test(PyObject *__pyx_v_self, PyOb * */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode); /*proto*/ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode, int __pyx_skip_dispatch) { int32_t __pyx_v_offset; int __pyx_r; @@ -4861,16 +5055,16 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("run"); + __Pyx_RefNannySetupContext("run", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_8pylibemu_8Emulator_8run)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pylibemu_8Emulator_17run)) { __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_shellcode); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shellcode); __Pyx_GIVEREF(__pyx_v_shellcode); @@ -4896,7 +5090,7 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_shellcode); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_shellcode); __Pyx_GIVEREF(__pyx_v_shellcode); @@ -4942,7 +5136,7 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * __pyx_t_3 = __Pyx_PyInt_to_py_int32_t(__pyx_v_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_shellcode); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shellcode); __Pyx_GIVEREF(__pyx_v_shellcode); @@ -4978,6 +5172,17 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("run (wrapper)", 0); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_16run(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), ((PyObject *)__pyx_v_shellcode)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "pylibemu.pyx":576 * return 0 * @@ -4986,17 +5191,16 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * * */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode); /*proto*/ -static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObject *__pyx_v_shellcode) { +static PyObject *__pyx_pf_8pylibemu_8Emulator_16run(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("run"); + __Pyx_RefNannySetupContext("run", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_8pylibemu_Emulator *)((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->__pyx_vtab)->run(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_shellcode, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, __pyx_v_shellcode, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5014,6 +5218,17 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObj return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_19offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_19offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("offset (wrapper)", 0); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_18offset(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "pylibemu.pyx":587 * * @property @@ -5022,15 +5237,14 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8run(PyObject *__pyx_v_self, PyObj * */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_9offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8pylibemu_8Emulator_9offset(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8pylibemu_8Emulator_18offset(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("offset"); + __Pyx_RefNannySetupContext("offset", 0); /* "pylibemu.pyx":588 * @property @@ -5040,7 +5254,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_9offset(PyObject *__pyx_v_self, CY * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5058,6 +5272,17 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_9offset(PyObject *__pyx_v_self, CY return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_21emu_profile_output(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_21emu_profile_output(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("emu_profile_output (wrapper)", 0); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_20emu_profile_output(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "pylibemu.pyx":591 * * @property @@ -5066,15 +5291,14 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_9offset(PyObject *__pyx_v_self, CY * */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_10emu_profile_output(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8pylibemu_8Emulator_10emu_profile_output(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8pylibemu_8Emulator_20emu_profile_output(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_output"); + __Pyx_RefNannySetupContext("emu_profile_output", 0); /* "pylibemu.pyx":592 * @property @@ -5084,7 +5308,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10emu_profile_output(PyObject *__p * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyBytes_FromString(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->emu_profile->output); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyBytes_FromString(__pyx_v_self->emu_profile->output); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -5102,6 +5326,17 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10emu_profile_output(PyObject *__p return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_23emu_profile_truncated(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_23emu_profile_truncated(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("emu_profile_truncated (wrapper)", 0); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_22emu_profile_truncated(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "pylibemu.pyx":595 * * @property @@ -5110,15 +5345,14 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10emu_profile_output(PyObject *__p * */ -static PyObject *__pyx_pf_8pylibemu_8Emulator_11emu_profile_truncated(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pf_8pylibemu_8Emulator_11emu_profile_truncated(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pf_8pylibemu_8Emulator_22emu_profile_truncated(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("emu_profile_truncated"); + __Pyx_RefNannySetupContext("emu_profile_truncated", 0); /* "pylibemu.pyx":596 * @property @@ -5128,7 +5362,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_11emu_profile_truncated(PyObject * * def memory_write_dword(self, addr, dword): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->emu_profile->truncate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->emu_profile->truncate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5146,41 +5380,28 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_11emu_profile_truncated(PyObject * return __pyx_r; } -/* "pylibemu.pyx":598 - * return self.emu_profile.truncate - * - * def memory_write_dword(self, addr, dword): # <<<<<<<<<<<<<< - * cdef c_emu_memory *_mem - * - */ - -static PyObject *__pyx_pf_8pylibemu_8Emulator_12memory_write_dword(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_8pylibemu_8Emulator_12memory_write_dword(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_25memory_write_dword(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_25memory_write_dword(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_addr = 0; PyObject *__pyx_v_dword = 0; - struct emu_memory *__pyx_v__mem; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - uint32_t __pyx_t_2; - uint32_t __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__addr,&__pyx_n_s__dword,0}; - __Pyx_RefNannySetupContext("memory_write_dword"); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("memory_write_dword (wrapper)", 0); { PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__addr); if (likely(values[0])) kw_args--; @@ -5193,7 +5414,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12memory_write_dword(PyObject *__p } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "memory_write_dword") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_dword") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5212,15 +5433,39 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12memory_write_dword(PyObject *__p __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_8Emulator_24memory_write_dword(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_addr, __pyx_v_dword); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pylibemu.pyx":598 + * return self.emu_profile.truncate + * + * def memory_write_dword(self, addr, dword): # <<<<<<<<<<<<<< + * cdef c_emu_memory *_mem + * + */ + +static PyObject *__pyx_pf_8pylibemu_8Emulator_24memory_write_dword(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_addr, PyObject *__pyx_v_dword) { + struct emu_memory *__pyx_v__mem; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + uint32_t __pyx_t_2; + uint32_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("memory_write_dword", 0); /* "pylibemu.pyx":601 - * cdef c_emu_memory *_mem + * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< * return -1 * */ - __pyx_t_1 = (((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu == NULL); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (__pyx_t_1) { /* "pylibemu.pyx":602 @@ -5234,33 +5479,33 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12memory_write_dword(PyObject *__p __Pyx_INCREF(__pyx_int_neg_1); __pyx_r = __pyx_int_neg_1; goto __pyx_L0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; /* "pylibemu.pyx":604 * return -1 * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< - * * emu_memory_write_dword(_mem, addr, dword) + * return 0 */ - __pyx_v__mem = emu_memory_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu); + __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":606 - * _mem = emu_memory_get(self._emu) + /* "pylibemu.pyx":605 * + * _mem = emu_memory_get(self._emu) * emu_memory_write_dword(_mem, addr, dword) # <<<<<<<<<<<<<< - * * return 0 + * */ - __pyx_t_2 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_addr); if (unlikely((__pyx_t_2 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_dword); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_addr); if (unlikely((__pyx_t_2 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_dword); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} emu_memory_write_dword(__pyx_v__mem, __pyx_t_2, __pyx_t_3); - /* "pylibemu.pyx":608 + /* "pylibemu.pyx":606 + * _mem = emu_memory_get(self._emu) * emu_memory_write_dword(_mem, addr, dword) - * * return 0 # <<<<<<<<<<<<<< * * def cpu_reg32_set(self, reg, val): @@ -5281,41 +5526,28 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12memory_write_dword(PyObject *__p return __pyx_r; } -/* "pylibemu.pyx":610 - * return 0 - * - * def cpu_reg32_set(self, reg, val): # <<<<<<<<<<<<<< - * cdef c_emu_cpu *_cpu - * - */ - -static PyObject *__pyx_pf_8pylibemu_8Emulator_13cpu_reg32_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_8pylibemu_8Emulator_13cpu_reg32_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_27cpu_reg32_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_27cpu_reg32_set(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_reg = 0; PyObject *__pyx_v_val = 0; - struct emu_cpu *__pyx_v__cpu; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - enum emu_reg32 __pyx_t_2; - uint32_t __pyx_t_3; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__reg,&__pyx_n_s__val,0}; - __Pyx_RefNannySetupContext("cpu_reg32_set"); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("cpu_reg32_set (wrapper)", 0); { PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reg); if (likely(values[0])) kw_args--; @@ -5324,11 +5556,11 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_13cpu_reg32_set(PyObject *__pyx_v_ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__val); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "cpu_reg32_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg32_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -5341,24 +5573,48 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_13cpu_reg32_set(PyObject *__pyx_v_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 608; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.cpu_reg32_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8pylibemu_8Emulator_26cpu_reg32_set(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self), __pyx_v_reg, __pyx_v_val); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pylibemu.pyx":608 + * return 0 + * + * def cpu_reg32_set(self, reg, val): # <<<<<<<<<<<<<< + * cdef c_emu_cpu *_cpu + * + */ - /* "pylibemu.pyx":613 - * cdef c_emu_cpu *_cpu +static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg32_set(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_reg, PyObject *__pyx_v_val) { + struct emu_cpu *__pyx_v__cpu; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + enum emu_reg32 __pyx_t_2; + uint32_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("cpu_reg32_set", 0); + + /* "pylibemu.pyx":611 + * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< * return -1 * */ - __pyx_t_1 = (((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu == NULL); + __pyx_t_1 = (__pyx_v_self->_emu == NULL); if (__pyx_t_1) { - /* "pylibemu.pyx":614 + /* "pylibemu.pyx":612 * * if self._emu is NULL: * return -1 # <<<<<<<<<<<<<< @@ -5369,36 +5625,36 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_13cpu_reg32_set(PyObject *__pyx_v_ __Pyx_INCREF(__pyx_int_neg_1); __pyx_r = __pyx_int_neg_1; goto __pyx_L0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "pylibemu.pyx":616 + /* "pylibemu.pyx":614 * return -1 * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< - * * emu_cpu_reg32_set(_cpu, reg, val) + * return 0 */ - __pyx_v__cpu = emu_cpu_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)->_emu); + __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":618 - * _cpu = emu_cpu_get(self._emu) + /* "pylibemu.pyx":615 * + * _cpu = emu_cpu_get(self._emu) * emu_cpu_reg32_set(_cpu, reg, val) # <<<<<<<<<<<<<< - * * return 0 + * */ - __pyx_t_2 = ((enum emu_reg32)PyInt_AsLong(__pyx_v_reg)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_val); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((enum emu_reg32)PyInt_AsLong(__pyx_v_reg)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_uint32_t(__pyx_v_val); if (unlikely((__pyx_t_3 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} emu_cpu_reg32_set(__pyx_v__cpu, __pyx_t_2, __pyx_t_3); - /* "pylibemu.pyx":620 + /* "pylibemu.pyx":616 + * _cpu = emu_cpu_get(self._emu) * emu_cpu_reg32_set(_cpu, reg, val) - * * return 0 # <<<<<<<<<<<<<< * - * + * def cpu_eip_get(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_int_0); @@ -5415,6 +5671,93 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_13cpu_reg32_set(PyObject *__pyx_v_ __Pyx_RefNannyFinishContext(); return __pyx_r; } + +/* Python wrapper */ +static PyObject *__pyx_pw_8pylibemu_8Emulator_29cpu_eip_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8pylibemu_8Emulator_29cpu_eip_get(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("cpu_eip_get (wrapper)", 0); + __pyx_r = __pyx_pf_8pylibemu_8Emulator_28cpu_eip_get(((struct __pyx_obj_8pylibemu_Emulator *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "pylibemu.pyx":618 + * return 0 + * + * def cpu_eip_get(self): # <<<<<<<<<<<<<< + * cdef c_emu_cpu *_cpu + * + */ + +static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_eip_get(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self) { + struct emu_cpu *__pyx_v__cpu; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("cpu_eip_get", 0); + + /* "pylibemu.pyx":621 + * cdef c_emu_cpu *_cpu + * + * if self._emu is NULL: # <<<<<<<<<<<<<< + * return -1 + * + */ + __pyx_t_1 = (__pyx_v_self->_emu == NULL); + if (__pyx_t_1) { + + /* "pylibemu.pyx":622 + * + * if self._emu is NULL: + * return -1 # <<<<<<<<<<<<<< + * + * _cpu = emu_cpu_get(self._emu) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_r = __pyx_int_neg_1; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "pylibemu.pyx":624 + * return -1 + * + * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< + * return emu_cpu_eip_get(_cpu) + */ + __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); + + /* "pylibemu.pyx":625 + * + * _cpu = emu_cpu_get(self._emu) + * return emu_cpu_eip_get(_cpu) # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_uint32_t(((uint32_t)emu_cpu_eip_get(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("pylibemu.Emulator.cpu_eip_get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} static struct __pyx_vtabstruct_8pylibemu_EmuProfile __pyx_vtable_8pylibemu_EmuProfile; static PyObject *__pyx_tp_new_8pylibemu_EmuProfile(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -5423,7 +5766,7 @@ static PyObject *__pyx_tp_new_8pylibemu_EmuProfile(PyTypeObject *t, PyObject *a, if (!o) return 0; p = ((struct __pyx_obj_8pylibemu_EmuProfile *)o); p->__pyx_vtab = __pyx_vtabptr_8pylibemu_EmuProfile; - if (__pyx_pf_8pylibemu_10EmuProfile___cinit__(o, a, k) < 0) { + if (__pyx_pw_8pylibemu_10EmuProfile_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -5599,7 +5942,7 @@ static PyObject *__pyx_tp_new_8pylibemu_Emulator(PyTypeObject *t, PyObject *a, P p = ((struct __pyx_obj_8pylibemu_Emulator *)o); p->__pyx_vtab = __pyx_vtabptr_8pylibemu_Emulator; p->emu_profile = ((struct __pyx_obj_8pylibemu_EmuProfile *)Py_None); Py_INCREF(Py_None); - if (__pyx_pf_8pylibemu_8Emulator___cinit__(o, a, k) < 0) { + if (__pyx_pw_8pylibemu_8Emulator_1__cinit__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -5611,7 +5954,7 @@ static void __pyx_tp_dealloc_8pylibemu_Emulator(PyObject *o) { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); - __pyx_pf_8pylibemu_8Emulator_1__dealloc__(o); + __pyx_pw_8pylibemu_8Emulator_3__dealloc__(o); if (PyErr_Occurred()) PyErr_WriteUnraisable(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); @@ -5639,18 +5982,19 @@ static int __pyx_tp_clear_8pylibemu_Emulator(PyObject *o) { } static PyMethodDef __pyx_methods_8pylibemu_Emulator[] = { - {__Pyx_NAMESTR("free"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_2free, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("new"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_3new, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("set_output_size"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_4set_output_size, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("shellcode_getpc_test"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_5shellcode_getpc_test, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_5shellcode_getpc_test)}, - {__Pyx_NAMESTR("prepare"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_6prepare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_6prepare)}, - {__Pyx_NAMESTR("test"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_7test, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_7test)}, - {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_8run, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("offset"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_9offset, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("emu_profile_output"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_10emu_profile_output, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("emu_profile_truncated"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_11emu_profile_truncated, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("memory_write_dword"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_12memory_write_dword, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("cpu_reg32_set"), (PyCFunction)__pyx_pf_8pylibemu_8Emulator_13cpu_reg32_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("free"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_5free, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("new"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_7new, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_output_size"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_9set_output_size, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("shellcode_getpc_test"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_10shellcode_getpc_test)}, + {__Pyx_NAMESTR("prepare"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_13prepare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_12prepare)}, + {__Pyx_NAMESTR("test"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_15test, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_14test)}, + {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_17run, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("offset"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_19offset, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("emu_profile_output"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_21emu_profile_output, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("emu_profile_truncated"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_23emu_profile_truncated, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("memory_write_dword"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_25memory_write_dword, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("cpu_reg32_set"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_27cpu_reg32_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("cpu_eip_get"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_29cpu_eip_get, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -5898,7 +6242,7 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "pylibemu.pyx":68 * @@ -5908,7 +6252,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_3 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3)); + __Pyx_GOTREF(__pyx_k_tuple_3); __Pyx_INCREF(Py_None); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, Py_None); __Pyx_GIVEREF(Py_None); @@ -5928,7 +6272,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); + __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); @@ -5942,7 +6286,7 @@ static int __Pyx_InitCachedConstants(void) { * cdef concatenate(self, char *dst, char *src, int n): */ __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); @@ -5956,7 +6300,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_4)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); @@ -5970,7 +6314,7 @@ static int __Pyx_InitCachedConstants(void) { * memset(t, 0, sizeof(t)) */ __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); + __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); @@ -5984,7 +6328,7 @@ static int __Pyx_InitCachedConstants(void) { * if ret == -1: */ __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28)); + __Pyx_GOTREF(__pyx_k_tuple_28); __Pyx_INCREF(((PyObject *)__pyx_n_s__Error)); PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_n_s__Error)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Error)); @@ -6036,12 +6380,18 @@ PyMODINIT_FUNC PyInit_pylibemu(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_pylibemu(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_pylibemu(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -6193,7 +6543,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__format), ((PyObject *)__pyx_kp_s_30)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__datefmt), ((PyObject *)__pyx_kp_s_31)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -6304,7 +6654,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __pyx_t_3 = __Pyx_GetName((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s__offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6325,7 +6675,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __pyx_t_3 = __Pyx_GetName((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s__emu_profile_output); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6346,7 +6696,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __pyx_t_3 = __Pyx_GetName((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_32); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6387,7 +6737,6 @@ PyMODINIT_FUNC PyInit_pylibemu(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -6464,7 +6813,6 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return -1; } - static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) @@ -6490,7 +6838,6 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; @@ -6500,7 +6847,7 @@ static int __Pyx_ParseOptionalKeywords( #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + if (unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { @@ -6516,7 +6863,6 @@ static int __Pyx_ParseOptionalKeywords( if (*name) { values[name-argnames] = value; } else { - /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 @@ -6566,7 +6912,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -6592,7 +6937,6 @@ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, Py_XINCREF(*value); Py_XINCREF(*tb); } - static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -6633,12 +6977,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -6685,10 +7050,8 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na PyObject *modname) { PyObject *result; PyObject *metaclass; - if (PyDict_SetItemString(dict, "__module__", modname) < 0) return NULL; - /* Python2 __metaclass__ */ metaclass = PyDict_GetItemString(dict, "__metaclass__"); if (metaclass) { @@ -6702,9 +7065,9 @@ static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *na } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -6714,19 +7077,75 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } +static CYTHON_INLINE uint16_t __Pyx_PyInt_from_py_uint16_t(PyObject* x) { + const uint16_t neg_one = (uint16_t)-1, const_zero = (uint16_t)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(uint16_t) == sizeof(char)) { + if (is_unsigned) + return (uint16_t)__Pyx_PyInt_AsUnsignedChar(x); + else + return (uint16_t)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(uint16_t) == sizeof(short)) { + if (is_unsigned) + return (uint16_t)__Pyx_PyInt_AsUnsignedShort(x); + else + return (uint16_t)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(uint16_t) == sizeof(int)) { + if (is_unsigned) + return (uint16_t)__Pyx_PyInt_AsUnsignedInt(x); + else + return (uint16_t)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(uint16_t) == sizeof(long)) { + if (is_unsigned) + return (uint16_t)__Pyx_PyInt_AsUnsignedLong(x); + else + return (uint16_t)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(uint16_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (uint16_t)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (uint16_t)__Pyx_PyInt_AsSignedLongLong(x); + } else { + uint16_t val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (uint16_t)-1; + } +} static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_int32_t(int32_t val) { const int32_t neg_one = (int32_t)-1, const_zero = (int32_t)0; @@ -6813,11 +7232,9 @@ static PyObject *__Pyx_GetStdout(void) { } return f; } - static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { PyObject* v; int i; - if (!f) { if (!(f = __Pyx_GetStdout())) return -1; @@ -6846,9 +7263,7 @@ static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { } return 0; } - #else /* Python 3 has a print function */ - static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { PyObject* kwargs = 0; PyObject* result = 0; @@ -6902,11 +7317,9 @@ static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { Py_XDECREF(kwargs); return -1; } - #endif #if PY_MAJOR_VERSION < 3 - static int __Pyx_PrintOne(PyObject* f, PyObject *o) { if (!f) { if (!(f = __Pyx_GetStdout())) @@ -6925,9 +7338,7 @@ static int __Pyx_PrintOne(PyObject* f, PyObject *o) { * compiler warnings about unused functions */ return __Pyx_Print(f, NULL, 0); } - #else /* Python 3 has a print function */ - static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { int res; PyObject* arg_tuple = PyTuple_New(1); @@ -6939,7 +7350,6 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { Py_DECREF(arg_tuple); return res; } - #endif static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) { @@ -6994,6 +7404,31 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_from_py_int32_t(PyObject* x) { } } +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_uint32_t(uint32_t val) { + const uint32_t neg_one = (uint32_t)-1, const_zero = (uint32_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(uint32_t) == sizeof(char)) || + (sizeof(uint32_t) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(uint32_t) == sizeof(int)) || + (sizeof(uint32_t) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(uint32_t) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(uint32_t), + little, !is_unsigned); + } +} + static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -7458,15 +7893,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -7482,7 +7912,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -7492,7 +7922,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -7511,12 +7941,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif + py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); @@ -7528,29 +7953,105 @@ static PyObject *__Pyx_ImportModule(const char *name) { } #endif +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -7561,28 +8062,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -7590,11 +8108,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -7629,6 +8145,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/src/pylibemu.pyx b/src/pylibemu.pyx index 6f785f8..18a9c54 100644 --- a/src/pylibemu.pyx +++ b/src/pylibemu.pyx @@ -596,27 +596,30 @@ cdef class Emulator: return self.emu_profile.truncate def memory_write_dword(self, addr, dword): - cdef c_emu_memory *_mem + cdef c_emu_memory *_mem if self._emu is NULL: return -1 _mem = emu_memory_get(self._emu) - emu_memory_write_dword(_mem, addr, dword) - return 0 def cpu_reg32_set(self, reg, val): - cdef c_emu_cpu *_cpu + cdef c_emu_cpu *_cpu if self._emu is NULL: return -1 _cpu = emu_cpu_get(self._emu) - emu_cpu_reg32_set(_cpu, reg, val) - return 0 + def cpu_eip_get(self): + cdef c_emu_cpu *_cpu + if self._emu is NULL: + return -1 + + _cpu = emu_cpu_get(self._emu) + return emu_cpu_eip_get(_cpu)