cemu-idapython/pywraps
elias.bachaalany@gmail.com 78c79f85b9 IDA Pro 6.5 support
What's new:
- Proper multi-threaded support 
- Better PyObject reference counting with ref_t and newref_t helper classes
- Improved the pywraps/deployment script
- Added IDAViewWrapper class and example
- Added idc.GetDisasmEx()
- Added idc.AddSegEx()
- Added idc.GetLocalTinfo()
- Added idc.ApplyType()
- Updated type information implementation
- Introduced the idaapi.require() - see http://www.hexblog.com/?p=749
- set REMOVE_CWD_SYS_PATH=1 by default in python.cfg (remove current directory from the import search path).

Various bugfixes:
- fixed various memory leaks
- asklong/askaddr/asksel (and corresponding idc.py functions) were returning results truncated to 32 bits in IDA64
- fix wrong documentation for idc.SizeOf
- GetFloat/GetDouble functions did not take into account endianness of the processor
- idaapi.NO_PROCESS was not defined, and was causing GetProcessPid() to fail
- idc.py: insert escape characters to string parameter when call Eval()
- idc.SaveFile/savefile were always overwriting an existing file instead of writing only the new data
- PluginForm.Close() wasn't passing its arguments to the delegate function, resulting in an error.
2013-12-30 01:34:23 +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 IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_askusingform.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_askusingform.py added PyWraps sources. This will facilitate deployment, development and debugging of IDAPython additions 2011-12-02 15:40:11 +00:00
py_bytes.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_choose2.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +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.5 support 2013-12-30 01:34:23 +00:00
py_graph.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_idaapi.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_idaapi.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_idaview.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_idaview.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_idp.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_kernwin.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +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.5 support 2013-12-30 01:34:23 +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.5 support 2013-12-30 01:34:23 +00:00
py_typeinf.py IDA Pro 6.5 support 2013-12-30 01:34:23 +00:00
py_ua.hpp IDA Pro 6.5 support 2013-12-30 01:34:23 +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.5 support 2013-12-30 01:34:23 +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).