mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-24 10:09:20 +01:00
python.cpp: Added RunPythonStatement() function to IDC
This commit is contained in:
parent
bab52674ca
commit
d99b2eb64b
13
python.cpp
13
python.cpp
@ -23,6 +23,7 @@
|
||||
#include <idp.hpp>
|
||||
#include <bytes.hpp>
|
||||
#include <diskio.hpp>
|
||||
#include <expr.hpp>
|
||||
#include <loader.hpp>
|
||||
#include <kernwin.hpp>
|
||||
#include <netnode.hpp>
|
||||
@ -76,6 +77,15 @@ int tracefunc(PyObject *obj, _frame *frame, int what, PyObject *arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Simple Python statement runner function for IDC */
|
||||
static const char idc_runpythonstatement_args[] = { VT_STR, 0 };
|
||||
static error_t idaapi idc_runpythonstatement(value_t *argv, value_t *res)
|
||||
{
|
||||
res->num = PyRun_SimpleString(argv[0].str);
|
||||
return eOk;
|
||||
}
|
||||
|
||||
|
||||
/* QuickFix for the FILE* incompatibility problem */
|
||||
int ExecFile(char *FileName)
|
||||
{
|
||||
@ -354,6 +364,9 @@ bool IDAPython_Init(void)
|
||||
(menu_item_callback_t *)IDAPython_Menu_Callback,
|
||||
(void *)IDAPYTHON_SCRIPTBOX);
|
||||
}
|
||||
|
||||
/* Register a RunPythonStatement() function for IDC */
|
||||
set_idc_func("RunPythonStatement", idc_runpythonstatement, idc_runpythonstatement_args);
|
||||
|
||||
initialized = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user