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 <idp.hpp>
|
||||||
#include <bytes.hpp>
|
#include <bytes.hpp>
|
||||||
#include <diskio.hpp>
|
#include <diskio.hpp>
|
||||||
|
#include <expr.hpp>
|
||||||
#include <loader.hpp>
|
#include <loader.hpp>
|
||||||
#include <kernwin.hpp>
|
#include <kernwin.hpp>
|
||||||
#include <netnode.hpp>
|
#include <netnode.hpp>
|
||||||
@ -76,6 +77,15 @@ int tracefunc(PyObject *obj, _frame *frame, int what, PyObject *arg)
|
|||||||
}
|
}
|
||||||
#endif
|
#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 */
|
/* QuickFix for the FILE* incompatibility problem */
|
||||||
int ExecFile(char *FileName)
|
int ExecFile(char *FileName)
|
||||||
{
|
{
|
||||||
@ -355,6 +365,9 @@ bool IDAPython_Init(void)
|
|||||||
(void *)IDAPYTHON_SCRIPTBOX);
|
(void *)IDAPYTHON_SCRIPTBOX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Register a RunPythonStatement() function for IDC */
|
||||||
|
set_idc_func("RunPythonStatement", idc_runpythonstatement, idc_runpythonstatement_args);
|
||||||
|
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user