cemu-idapython/pywraps
elias.bachaalany@gmail.com fbb5bfabd6 IDA Pro 6.6 support
What's new:
- added the decompiler bindings
- Expose simpleline_t type to IDAPython. That lets the user to set the bgcolor & text for each line in the decompilation.
- Wrapped new functions from the IDA SDK

Various fixes:
for non-code locations, idc.GetOpnd() would create instructions instead of returning empty result
- idb_event::area_cmt_changed was never received in IDB_Hooks (and descendants)
- idb_event::ti_changed, and idb_event::op_ti_changed notifications were not accessible in IDAPython
- op_t.value was truncated to 32 bits under IDA64.
- print_tinfo() wouldn't return a valid string.
- readsel2() was not usable.
- read_selection() was buggy for 64-bit programs.
- StructMembers() considered holes in structures, and didn't properly iterate through the whole structure definition.
- There was no way to call calc_switch_cases() from IDAPython.
- when using multi-select/multi-edit choosers, erroneous event codes could be sent at beginning & end of batch deletion of lines.
- When, in a PluginForm#OnCreate, the layout of IDA was requested to change (for example by starting a debugging session), that PluginForm could be deleted and create an access violation.
- tinfo_t objects created from IDAPython could cause an assertion failure at exit time.
- Usage of IDAPython's DropdownListControl was broken.
2014-07-04 22:02:42 +00:00
..
deploy_all.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
deploy.bat IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
deploy.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
driver_bytes.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_chooser.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_cli.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_custdata.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_custview.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_dbg.cpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
driver_diskio.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_expr.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_graph.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_kernwin.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_nalt.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver_notifywhen.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
driver.cpp - IDA Pro 6.3 support 2012-06-24 20:49:11 +00:00
link_gen.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_appcall.py - Fixed idaapi.read_selection() 2014-04-08 00:11:43 +00:00
py_askusingform.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_askusingform.py IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_bytes.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_choose2.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_choose2.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_choose.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_cli.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_cli.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_custdata.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_custdata.py Applied patches from Hex-Rays: 2013-03-06 07:44:10 +00:00
py_custview.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_custview.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_cvt.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_dbg.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_dbg.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_diskio.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_diskio.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_expr.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_expr.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_gdl.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_graph.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_graph.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_idaapi.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_idaapi.py IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_idaview.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_idaview.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_idp.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_kernwin.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_kernwin.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_lines.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_lines.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_linput.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_loader.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_nalt.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_nalt.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_name.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_name.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_notifywhen.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_notifywhen.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_plgform.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_plgform.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_qfile.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_typeinf.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_typeinf.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_ua.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_ua.py Applied patches from Hex-Rays: 2013-03-06 07:44:10 +00:00
py_view_base.hpp IDA Pro 6.6 support 2014-07-04 22:02:42 +00:00
py_view_base.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
pywraps.hpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
pywraps.sln added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
pywraps.vcproj added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
pywraps.vcxproj added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
pywraps.vcxproj.filters added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
readme.txt added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
sidaapi.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
sidc.py Applied patches from Hex-Rays: 2013-03-06 07:44:10 +00:00
swig_stub.cpp added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
swig_stub.h added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00

============================
deploy.py - usage
============================

The deploy script is used to deploy python and c++ code into SWIG interface files appropriately.
The reason it was created was because working with .i files to put a mixture of C++ and Python code is not practical for testing and development process.

In SWIG, there are three sections:

Inline
---------

C++ code will be wrapped by SWIG.

In SWIG .i files the inline code is marked with:
        %inline %{
          C++ code
        %}

In deploy.py supporting files the code to be pasted into .i files is marked with:
        //<inline(NAME)>
          C++ code
        //</inline(NAME)>


Code
-------
C++ code will be pasted and compiled into the wrapped module but will not be wrapped by SWIG.

In SWIG .i files the code is marked with:
        %{
        C++ code
        %}

Similarly, for deploy.py supporting files should be marked with:
        //<code(NAME)>
          C++ code
        //</code(NAME)>

Pythoncode
--------------

Python code allows you to insert Python code into the final Python module.

In SWIG .i files, the extra python code is marked with:
        %pythoncode %{
        Py code
        %}

In deploy.py supporting python files, it is marked with:
        #<pycode(NAME)>
        Py code
        #</pycode(NAME)>

Using deploy.py
------------------
Make sure that all of the 3 code markers exist in the interface files and deploy.py support files (C++ or Python).

As an example, let us interpret the meaning of:
        deploy.py py_idaapi py_idaapi.hpp,py_idaapi.py ..\swig\idaapi.i
It means:
        NAME = py_idaapi
        ...take code snips from py_idaapi.hpp and py_idaapi.py
        ...and paste the code there into idaapi.i SWIG interface file

Now remember that both the input files have the special markers (discussed above) and so does idaapi.i file


============================
linkgen.py - usage
============================
TODO


============================
swigdocs.py - usage
============================

The swigdocs script will extract python comments from SWIG interface files (*.i).

There are two places where Python code documentation can be found:
  1. In the "%pythoncode %{" section, we extract all the python code because it could contain docstrings.
  Inside the pythoncode section, one can find embedded commented that are commented out.
  Because they are commented out, the documentation generator will miss them. The swigdocs script will remove the comment character:
#<pydoc>
#    def OnClose(self):
#        """
#        Called when the window is being closed.
#        This callback is mandatory.
#        @return: nothing
#        """
#        pass
#</pydoc>
  After swigdocs finishes, the output will contain all the python code and all the commented code (now uncommented).

  2. In the "%inline %{" section (in C++ code), one can find functions comments like this:
/*
#<pydoc>
def dbg_read_memory(ea, sz):
    """
    Reads from the debugee's memory at the specified ea
    @return:
        - The read buffer (as a string)
        - Or None on failure
    """
    pass
#</pydoc>
*/
static PyObject *dbg_read_memory(PyObject *py_ea, PyObject *py_sz)
{
   ......
}
  In this case, the code inside <pydoc> tag will be extracted as well.


After swigdocs finishes, the output is a Python file containing all code and comments extracted from the *.i file(s).