All text files converted to DOS LFs.

This commit is contained in:
gergely.erdelyi 2008-09-28 10:20:47 +00:00
parent 289133158f
commit 4af9448cce
26 changed files with 1623 additions and 1623 deletions

850
build.py
View File

@ -1,425 +1,425 @@
#!/usr/bin/env python #!/usr/bin/env python
#------------------------------------------------------------ #------------------------------------------------------------
# IDAPython - Python plugin for Interactive Disassembler Pro # IDAPython - Python plugin for Interactive Disassembler Pro
# #
# Copyright (c) 2004-2008 Gergely Erdelyi <dyce@d-dome.net> # Copyright (c) 2004-2008 Gergely Erdelyi <dyce@d-dome.net>
# #
# All rights reserved. # All rights reserved.
# #
# For detailed copyright information see the file COPYING in # For detailed copyright information see the file COPYING in
# the root of the distribution archive. # the root of the distribution archive.
#------------------------------------------------------------ #------------------------------------------------------------
# build.py - Custom build script # build.py - Custom build script
#------------------------------------------------------------ #------------------------------------------------------------
import os import os
import platform import platform
import shutil import shutil
import sys import sys
import types import types
import zipfile import zipfile
from distutils import sysconfig from distutils import sysconfig
# Start of user configurable options # Start of user configurable options
VERBOSE = True VERBOSE = True
IDA_MAJOR_VERSION = 5 IDA_MAJOR_VERSION = 5
IDA_MINOR_VERSION = 1 IDA_MINOR_VERSION = 1
IDA_SDK = ".." + os.sep + "swigsdk-versions" + os.sep + "%d.%d" % (IDA_MAJOR_VERSION, IDA_MINOR_VERSION) IDA_SDK = ".." + os.sep + "swigsdk-versions" + os.sep + "%d.%d" % (IDA_MAJOR_VERSION, IDA_MINOR_VERSION)
# End of user configurable options # End of user configurable options
# IDAPython version # IDAPython version
VERSION_MAJOR = 1 VERSION_MAJOR = 1
VERSION_MINOR = 0 VERSION_MINOR = 0
VERSION_PATCH = 0 VERSION_PATCH = 0
# Determine Python version # Determine Python version
PYTHON_MAJOR_VERSION = int(platform.python_version()[0]) PYTHON_MAJOR_VERSION = int(platform.python_version()[0])
PYTHON_MINOR_VERSION = int(platform.python_version()[2]) PYTHON_MINOR_VERSION = int(platform.python_version()[2])
# Find Python headers # Find Python headers
PYTHON_INCLUDE_DIRECTORY = sysconfig.get_config_var('INCLUDEPY') PYTHON_INCLUDE_DIRECTORY = sysconfig.get_config_var('INCLUDEPY')
# Swig command-line parameters # Swig command-line parameters
SWIG_OPTIONS = '-modern -python -c++ -w451 -shadow -D__GNUC__' SWIG_OPTIONS = '-modern -python -c++ -w451 -shadow -D__GNUC__'
# Common macros for all compilations # Common macros for all compilations
COMMON_MACROS = [ COMMON_MACROS = [
("VER_MAJOR", "%d" % VERSION_MAJOR), ("VER_MAJOR", "%d" % VERSION_MAJOR),
("VER_MINOR", "%d" % VERSION_MINOR), ("VER_MINOR", "%d" % VERSION_MINOR),
("VER_PATCH", "%d" % VERSION_PATCH), ("VER_PATCH", "%d" % VERSION_PATCH),
"__IDP__", "__IDP__",
("MAXSTR", "1024"), ("MAXSTR", "1024"),
"USE_DANGEROUS_FUNCTIONS", "USE_DANGEROUS_FUNCTIONS",
"USE_STANDARD_FILE_FUNCTIONS" ] "USE_STANDARD_FILE_FUNCTIONS" ]
# Common includes for all compilations # Common includes for all compilations
COMMON_INCLUDES = [ ".", "swig" ] COMMON_INCLUDES = [ ".", "swig" ]
# List files for the binary distribution # List files for the binary distribution
BINDIST_MANIFEST = [ BINDIST_MANIFEST = [
"README.txt", "README.txt",
"COPYING.txt", "COPYING.txt",
"CHANGES.txt", "CHANGES.txt",
"STATUS.txt", "STATUS.txt",
"python/init.py", "python/init.py",
"python/idc.py", "python/idc.py",
"python/idautils.py", "python/idautils.py",
("idaapi.py", "python"), ("idaapi.py", "python"),
"docs/notes.txt", "docs/notes.txt",
"examples/chooser.py", "examples/chooser.py",
"examples/colours.py", "examples/colours.py",
"examples/debughook.py", "examples/debughook.py",
"examples/ex1.idc", "examples/ex1.idc",
"examples/ex1_idaapi.py", "examples/ex1_idaapi.py",
"examples/ex1_idautils.py", "examples/ex1_idautils.py",
"examples/hotkey.py", "examples/hotkey.py",
"examples/structure.py", "examples/structure.py",
] ]
# List files for the source distribution (appended to binary list) # List files for the source distribution (appended to binary list)
SRCDIST_MANIFEST = [ SRCDIST_MANIFEST = [
"BUILDING.txt", "BUILDING.txt",
"python.cpp", "python.cpp",
"basetsd.h", "basetsd.h",
"build.py", "build.py",
"swig/allins.i", "swig/allins.i",
"swig/auto.i", "swig/auto.i",
"swig/bytes.i", "swig/bytes.i",
"swig/dbg.i", "swig/dbg.i",
"swig/diskio.i", "swig/diskio.i",
"swig/entry.i", "swig/entry.i",
"swig/enum.i", "swig/enum.i",
"swig/expr.i", "swig/expr.i",
"swig/fixup.i", "swig/fixup.i",
"swig/frame.i", "swig/frame.i",
"swig/funcs.i", "swig/funcs.i",
"swig/ida.i", "swig/ida.i",
"swig/idaapi.i", "swig/idaapi.i",
"swig/idp.i", "swig/idp.i",
"swig/ints.i", "swig/ints.i",
"swig/kernwin.i", "swig/kernwin.i",
"swig/lines.i", "swig/lines.i",
"swig/loader.i", "swig/loader.i",
"swig/moves.i", "swig/moves.i",
"swig/nalt.i", "swig/nalt.i",
"swig/name.i", "swig/name.i",
"swig/offset.i", "swig/offset.i",
"swig/pro.i", "swig/pro.i",
"swig/queue.i", "swig/queue.i",
"swig/search.i", "swig/search.i",
"swig/segment.i", "swig/segment.i",
"swig/srarea.i", "swig/srarea.i",
"swig/strlist.i", "swig/strlist.i",
"swig/struct.i", "swig/struct.i",
"swig/typeconv.i", "swig/typeconv.i",
"swig/typeinf.i", "swig/typeinf.i",
"swig/ua.i", "swig/ua.i",
"swig/xref.i", "swig/xref.i",
"patches/ida51.patch", "patches/ida51.patch",
"tools/gendocs.py", "tools/gendocs.py",
] ]
# Temporaty build files to remove # Temporaty build files to remove
BUILD_TEMPFILES = [ BUILD_TEMPFILES = [
"idaapi.cpp", "idaapi.cpp",
"idaapi.obj", "idaapi.obj",
"idaapi.o", "idaapi.o",
"idaapi.py", "idaapi.py",
"idapython.sln", "idapython.sln",
"idapython.ncb", "idapython.ncb",
"python.exp", "python.exp",
"python.lib", "python.lib",
"python.obj" "python.obj"
] ]
class BuilderBase: class BuilderBase:
""" Base class for builders """ """ Base class for builders """
def __init__(self): def __init__(self):
pass pass
def compile(self, source, objectname=None, includes=[], macros=[]): def compile(self, source, objectname=None, includes=[], macros=[]):
""" """
Compile the source file Compile the source file
""" """
allmacros = [] allmacros = []
allmacros.extend(COMMON_MACROS) allmacros.extend(COMMON_MACROS)
allmacros.extend(self.basemacros) allmacros.extend(self.basemacros)
allmacros.extend(macros) allmacros.extend(macros)
macrostring = self._build_command_string(allmacros, self.macro_delimiter) macrostring = self._build_command_string(allmacros, self.macro_delimiter)
allincludes = [] allincludes = []
allincludes.extend(COMMON_INCLUDES) allincludes.extend(COMMON_INCLUDES)
allincludes.extend(includes) allincludes.extend(includes)
includestring = self._build_command_string(allincludes, self.include_delimiter) includestring = self._build_command_string(allincludes, self.include_delimiter)
if not objectname: if not objectname:
objectname = source + self.object_extension objectname = source + self.object_extension
cmdstring = "%s %s %s %s %s %s" % (self.compiler, cmdstring = "%s %s %s %s %s %s" % (self.compiler,
self.compiler_parameters, self.compiler_parameters,
self.compiler_out_string(objectname), self.compiler_out_string(objectname),
self.compiler_in_string(source + self.source_extension), self.compiler_in_string(source + self.source_extension),
includestring, includestring,
macrostring) macrostring)
if VERBOSE: print cmdstring if VERBOSE: print cmdstring
return os.system(cmdstring) return os.system(cmdstring)
def link(self, objects, outfile, libpaths=[], libraries=[], extra_parameters=None): def link(self, objects, outfile, libpaths=[], libraries=[], extra_parameters=None):
""" Link the binary from objects and libraries """ """ Link the binary from objects and libraries """
cmdstring = "%s %s %s" % (self.linker, cmdstring = "%s %s %s" % (self.linker,
self.linker_parameters, self.linker_parameters,
self.linker_out_string(outfile)) self.linker_out_string(outfile))
for objectfile in objects: for objectfile in objects:
cmdstring = "%s %s" % (cmdstring, objectfile + self.object_extension) cmdstring = "%s %s" % (cmdstring, objectfile + self.object_extension)
for libpath in libpaths: for libpath in libpaths:
cmdstring = "%s %s%s" % (cmdstring, self.libpath_delimiter, libpath) cmdstring = "%s %s%s" % (cmdstring, self.libpath_delimiter, libpath)
for library in libraries: for library in libraries:
cmdstring = "%s %s" % (cmdstring, library) cmdstring = "%s %s" % (cmdstring, library)
if extra_parameters: if extra_parameters:
cmdstring = "%s %s" % (cmdstring, extra_parameters) cmdstring = "%s %s" % (cmdstring, extra_parameters)
if VERBOSE: print cmdstring if VERBOSE: print cmdstring
return os.system(cmdstring) return os.system(cmdstring)
def _build_command_string(self, macros, argument_delimiter): def _build_command_string(self, macros, argument_delimiter):
macrostring = "" macrostring = ""
for item in macros: for item in macros:
if type(item) == types.TupleType: if type(item) == types.TupleType:
macrostring += '%s%s="%s" ' % (argument_delimiter, item[0], item[1]) macrostring += '%s%s="%s" ' % (argument_delimiter, item[0], item[1])
else: else:
macrostring += '%s%s ' % (argument_delimiter, item) macrostring += '%s%s ' % (argument_delimiter, item)
return macrostring return macrostring
class GCCBuilder(BuilderBase): class GCCBuilder(BuilderBase):
""" Generic GCC compiler class """ """ Generic GCC compiler class """
def __init__(self): def __init__(self):
self.include_delimiter = "-I" self.include_delimiter = "-I"
self.macro_delimiter = "-D" self.macro_delimiter = "-D"
self.libpath_delimiter = "-L" self.libpath_delimiter = "-L"
self.compiler_parameters = "-fpermissive" self.compiler_parameters = "-fpermissive"
self.linker_parameters = "-shared" self.linker_parameters = "-shared"
self.basemacros = [ ] self.basemacros = [ ]
self.compiler = "g++" self.compiler = "g++"
self.linker = "g++" self.linker = "g++"
self.source_extension = ".cpp" self.source_extension = ".cpp"
self.object_extension = ".o" self.object_extension = ".o"
def compiler_in_string(self, filename): def compiler_in_string(self, filename):
return "-c %s" % filename return "-c %s" % filename
def compiler_out_string(self, filename): def compiler_out_string(self, filename):
return "-o %s" % filename return "-o %s" % filename
def linker_out_string(self, filename): def linker_out_string(self, filename):
return "-o %s" % filename return "-o %s" % filename
class MSVCBuilder(BuilderBase): class MSVCBuilder(BuilderBase):
""" Generic GCC compiler class """ """ Generic GCC compiler class """
def __init__(self): def __init__(self):
self.include_delimiter = "/I" self.include_delimiter = "/I"
self.macro_delimiter = "/D" self.macro_delimiter = "/D"
self.libpath_delimiter = "/LIBPATH:" self.libpath_delimiter = "/LIBPATH:"
self.compiler_parameters = "/nologo /EHsc" self.compiler_parameters = "/nologo /EHsc"
self.linker_parameters = "/nologo /dll /export:PLUGIN" self.linker_parameters = "/nologo /dll /export:PLUGIN"
self.basemacros = [ "WIN32", self.basemacros = [ "WIN32",
"_USRDLL", "_USRDLL",
"__NT__" ] "__NT__" ]
self.compiler = "cl" self.compiler = "cl"
self.linker = "link" self.linker = "link"
self.source_extension = ".cpp" self.source_extension = ".cpp"
self.object_extension = ".obj" self.object_extension = ".obj"
def compiler_in_string(self, filename): def compiler_in_string(self, filename):
return "/c %s" % filename return "/c %s" % filename
def compiler_out_string(self, filename): def compiler_out_string(self, filename):
return "/Fo%s" % filename return "/Fo%s" % filename
def linker_out_string(self, filename): def linker_out_string(self, filename):
return "/out:%s" % filename return "/out:%s" % filename
def build_distribution(manifest, distrootdir): def build_distribution(manifest, distrootdir):
""" Create dist tree and copy files to it """ """ Create dist tree and copy files to it """
# Remove the previous distibution if exits # Remove the previous distibution if exits
if os.path.exists(distrootdir): if os.path.exists(distrootdir):
shutil.rmtree(distrootdir) shutil.rmtree(distrootdir)
# Also make a ZIP archive of the build # Also make a ZIP archive of the build
zippath = distrootdir + ".zip" zippath = distrootdir + ".zip"
zip = zipfile.ZipFile(zippath, "w", zipfile.ZIP_DEFLATED) zip = zipfile.ZipFile(zippath, "w", zipfile.ZIP_DEFLATED)
# Create output directory # Create output directory
os.makedirs(distrootdir) os.makedirs(distrootdir)
# Copy files, one by one # Copy files, one by one
for f in manifest: for f in manifest:
if type(f) == types.TupleType: if type(f) == types.TupleType:
srcfilepath = f[0] srcfilepath = f[0]
srcfilename = os.path.basename(srcfilepath) srcfilename = os.path.basename(srcfilepath)
dstdir = distrootdir + os.sep + f[1] dstdir = distrootdir + os.sep + f[1]
dstfilepath = dstdir + os.sep + srcfilename dstfilepath = dstdir + os.sep + srcfilename
else: else:
srcfilepath = f srcfilepath = f
srcfilename = os.path.basename(f) srcfilename = os.path.basename(f)
srcdir = os.path.dirname(f) srcdir = os.path.dirname(f)
if srcdir == "": if srcdir == "":
dstdir = distrootdir dstdir = distrootdir
else: else:
dstdir = distrootdir + os.sep + srcdir dstdir = distrootdir + os.sep + srcdir
if not os.path.exists(dstdir): if not os.path.exists(dstdir):
os.makedirs(dstdir) os.makedirs(dstdir)
dstfilepath = dstdir + os.sep + srcfilename dstfilepath = dstdir + os.sep + srcfilename
shutil.copyfile(srcfilepath, dstfilepath) shutil.copyfile(srcfilepath, dstfilepath)
zip.write(dstfilepath) zip.write(dstfilepath)
zip.close() zip.close()
def build_plugin(system, idasdkdir): def build_plugin(system, idasdkdir):
""" Build the plugin from the SWIG wrapper and plugin main source """ """ Build the plugin from the SWIG wrapper and plugin main source """
# Find IDA SDK headers # Find IDA SDK headers
ida_include_directory = idasdkdir + os.sep + "include" ida_include_directory = idasdkdir + os.sep + "include"
# Platform-specific settings for the Linux build # Platform-specific settings for the Linux build
if system == "Linux": if system == "Linux":
builder = GCCBuilder() builder = GCCBuilder()
plugin_name = "python.plx" plugin_name = "python.plx"
platform_macros = [ "__LINUX__" ] platform_macros = [ "__LINUX__" ]
python_libpath = sysconfig.EXEC_PREFIX + os.sep + "lib" python_libpath = sysconfig.EXEC_PREFIX + os.sep + "lib"
python_library = "-lpython%d.%d" % (PYTHON_MAJOR_VERSION, PYTHON_MINOR_VERSION) python_library = "-lpython%d.%d" % (PYTHON_MAJOR_VERSION, PYTHON_MINOR_VERSION)
ida_libpath = idasdkdir + os.sep + "libgcc32.lnx" ida_libpath = idasdkdir + os.sep + "libgcc32.lnx"
ida_lib = "" ida_lib = ""
extra_link_parameters = "/usr/lib/python%s.%s/lib-dynload/*.so" % (PYTHON_MAJOR_VERSION, PYTHON_MINOR_VERSION) extra_link_parameters = "/usr/lib/python%s.%s/lib-dynload/*.so" % (PYTHON_MAJOR_VERSION, PYTHON_MINOR_VERSION)
# Platform-specific settings for the Windows build # Platform-specific settings for the Windows build
if system == "Windows": if system == "Windows":
builder = MSVCBuilder() builder = MSVCBuilder()
plugin_name = "python.plw" plugin_name = "python.plw"
platform_macros = [ "__NT__" ] platform_macros = [ "__NT__" ]
python_libpath = sysconfig.EXEC_PREFIX + os.sep + "libs" python_libpath = sysconfig.EXEC_PREFIX + os.sep + "libs"
python_library = "python%d%d.lib" % (PYTHON_MAJOR_VERSION, PYTHON_MINOR_VERSION) python_library = "python%d%d.lib" % (PYTHON_MAJOR_VERSION, PYTHON_MINOR_VERSION)
ida_libpath = idasdkdir + os.sep + "libvc.w32" ida_libpath = idasdkdir + os.sep + "libvc.w32"
ida_lib = "ida.lib" ida_lib = "ida.lib"
extra_link_parameters = None extra_link_parameters = None
# Platform-specific settings for the Linux build # Platform-specific settings for the Linux build
if system == "Darwin": if system == "Darwin":
builder = GCCBuilder() builder = GCCBuilder()
builder.linker_parameters = "-dynamiclib" builder.linker_parameters = "-dynamiclib"
plugin_name = "python.pmc" plugin_name = "python.pmc"
platform_macros = [ "__MAC__" ] platform_macros = [ "__MAC__" ]
python_libpath = "." python_libpath = "."
python_library = "-framework Python" python_library = "-framework Python"
ida_libpath = idasdkdir + os.sep + "libgcc32.mac" ida_libpath = idasdkdir + os.sep + "libgcc32.mac"
ida_lib = "-lida" ida_lib = "-lida"
extra_link_parameters = "" extra_link_parameters = ""
# Build the wrapper from the interface files # Build the wrapper from the interface files
swigcmd = "swig %s -Iswig -o idaapi.cpp -I%s idaapi.i" % (SWIG_OPTIONS, ida_include_directory) swigcmd = "swig %s -Iswig -o idaapi.cpp -I%s idaapi.i" % (SWIG_OPTIONS, ida_include_directory)
if VERBOSE: print swigcmd if VERBOSE: print swigcmd
res = os.system(swigcmd) res = os.system(swigcmd)
if res != 0: return False if res != 0: return False
# Compile the wrapper # Compile the wrapper
res = builder.compile("idaapi", res = builder.compile("idaapi",
includes=[ PYTHON_INCLUDE_DIRECTORY, ida_include_directory ], includes=[ PYTHON_INCLUDE_DIRECTORY, ida_include_directory ],
macros=platform_macros) macros=platform_macros)
if res != 0: return False if res != 0: return False
# Compile the main plugin source # Compile the main plugin source
res = builder.compile("python", res = builder.compile("python",
includes=[ PYTHON_INCLUDE_DIRECTORY, ida_include_directory ], includes=[ PYTHON_INCLUDE_DIRECTORY, ida_include_directory ],
macros=platform_macros) macros=platform_macros)
if res != 0: return False if res != 0: return False
# Link the final binary # Link the final binary
res = builder.link( ["idaapi", "python"], res = builder.link( ["idaapi", "python"],
plugin_name, plugin_name,
[ python_libpath, ida_libpath ], [ python_libpath, ida_libpath ],
[ python_library, ida_lib ], [ python_library, ida_lib ],
extra_link_parameters) extra_link_parameters)
if res != 0: return False if res != 0: return False
return True return True
def clean(manifest): def clean(manifest):
""" Clean the temporary files """ """ Clean the temporary files """
for i in manifest: for i in manifest:
try: try:
os.unlink(i) os.unlink(i)
except: except:
pass pass
if __name__ == "__main__": if __name__ == "__main__":
# Detect the platform # Detect the platform
system = platform.system() system = platform.system()
if system == "Windows" or system == "Microsoft": if system == "Windows" or system == "Microsoft":
platform_string = "win32" platform_string = "win32"
plugin_name = "python.plw" plugin_name = "python.plw"
if system == "Linux": if system == "Linux":
platform_string = "linux" platform_string = "linux"
plugin_name = "python.plx" plugin_name = "python.plx"
if system == "Darwin": if system == "Darwin":
platform_string = "macosx" platform_string = "macosx"
plugin_name = "python.pmc" plugin_name = "python.pmc"
BINDISTDIR = "idapython-%d.%d.%d_ida%d.%d_py%d.%d_%s" % (VERSION_MAJOR, BINDISTDIR = "idapython-%d.%d.%d_ida%d.%d_py%d.%d_%s" % (VERSION_MAJOR,
VERSION_MINOR, VERSION_MINOR,
VERSION_PATCH, VERSION_PATCH,
IDA_MAJOR_VERSION, IDA_MAJOR_VERSION,
IDA_MINOR_VERSION, IDA_MINOR_VERSION,
PYTHON_MAJOR_VERSION, PYTHON_MAJOR_VERSION,
PYTHON_MINOR_VERSION, PYTHON_MINOR_VERSION,
platform_string) platform_string)
SRCDISTDIR = "idapython-%d.%d.%d" % (VERSION_MAJOR, SRCDISTDIR = "idapython-%d.%d.%d" % (VERSION_MAJOR,
VERSION_MINOR, VERSION_MINOR,
VERSION_PATCH) VERSION_PATCH)
# Build the plugin # Build the plugin
res = build_plugin(system, IDA_SDK) res = build_plugin(system, IDA_SDK)
if not res: sys.exit(1) if not res: sys.exit(1)
# Build the binary distribution # Build the binary distribution
binmanifest = [] binmanifest = []
binmanifest.extend(BINDIST_MANIFEST) binmanifest.extend(BINDIST_MANIFEST)
binmanifest.append((plugin_name, "plugins")) binmanifest.append((plugin_name, "plugins"))
build_distribution(binmanifest, BINDISTDIR) build_distribution(binmanifest, BINDISTDIR)
# Build the binary distribution # Build the binary distribution
srcmanifest = [] srcmanifest = []
srcmanifest.extend(BINDIST_MANIFEST) srcmanifest.extend(BINDIST_MANIFEST)
srcmanifest.extend(SRCDIST_MANIFEST) srcmanifest.extend(SRCDIST_MANIFEST)
build_distribution(srcmanifest, SRCDISTDIR) build_distribution(srcmanifest, SRCDISTDIR)
# Clean the temp files # Clean the temp files
cleanlist = [] cleanlist = []
cleanlist.extend(BUILD_TEMPFILES) cleanlist.extend(BUILD_TEMPFILES)
cleanlist.append(plugin_name) cleanlist.append(plugin_name)
# clean(cleanlist) # clean(cleanlist)

View File

@ -1,29 +1,29 @@
# #
# Reference Lister # Reference Lister
# #
# List all functions and all references to them in the current section. # List all functions and all references to them in the current section.
# #
# Implemented using direct IDA Plugin API calls # Implemented using direct IDA Plugin API calls
# #
from idaapi import * from idaapi import *
# Get current ea # Get current ea
ea = get_screen_ea() ea = get_screen_ea()
# Get segment class # Get segment class
seg = getseg(ea) seg = getseg(ea)
# Loop from segment start to end # Loop from segment start to end
func = get_func(seg.startEA) func = get_func(seg.startEA)
while func != None and func.startEA < seg.endEA: while func != None and func.startEA < seg.endEA:
funcea = func.startEA funcea = func.startEA
print "Function %s at 0x%x" % (GetFunctionName(funcea), funcea) print "Function %s at 0x%x" % (GetFunctionName(funcea), funcea)
ref = get_first_cref_to(funcea) ref = get_first_cref_to(funcea)
while ref != BADADDR: while ref != BADADDR:
print " called from %s(0x%x)" % (get_func_name(ref), ref) print " called from %s(0x%x)" % (get_func_name(ref), ref)
ref = get_next_cref_to(funcea, ref) ref = get_next_cref_to(funcea, ref)
func = get_next_func(funcea) func = get_next_func(funcea)

View File

@ -1,20 +1,20 @@
# #
# Reference Lister # Reference Lister
# #
# List all functions and all references to them in the current section. # List all functions and all references to them in the current section.
# #
# Implemented with the idautils module # Implemented with the idautils module
# #
from idautils import * from idautils import *
# Get current ea # Get current ea
ea = ScreenEA() ea = ScreenEA()
# Loop from start to end in the current segment # Loop from start to end in the current segment
for funcea in Functions(SegStart(ea), SegEnd(ea)): for funcea in Functions(SegStart(ea), SegEnd(ea)):
print "Function %s at 0x%x" % (GetFunctionName(funcea), funcea) print "Function %s at 0x%x" % (GetFunctionName(funcea), funcea)
# Find all code references to funcea # Find all code references to funcea
for ref in CodeRefsTo(funcea, 1): for ref in CodeRefsTo(funcea, 1):
print " called from %s(0x%x)" % (GetFunctionName(ref), ref) print " called from %s(0x%x)" % (GetFunctionName(ref), ref)

View File

@ -1,7 +1,7 @@
// Ignore the unnedded externals // Ignore the unnedded externals
%ignore Instructions; %ignore Instructions;
// This makes SWIG ignore the size def for the Intel enum // This makes SWIG ignore the size def for the Intel enum
#define ENUM_SIZE(x) #define ENUM_SIZE(x)
%include "allins.hpp" %include "allins.hpp"

View File

@ -1,13 +1,13 @@
%ignore auto_process_all; %ignore auto_process_all;
%ignore autoPlanned; %ignore autoPlanned;
%ignore nextPlanned; %ignore nextPlanned;
%ignore autoDelCode; %ignore autoDelCode;
%ignore autoPeek; %ignore autoPeek;
%ignore autoProcess; %ignore autoProcess;
%ignore auto_init; %ignore auto_init;
%ignore auto_save; %ignore auto_save;
%ignore auto_term; %ignore auto_term;
%ignore ea_without_xrefs; %ignore ea_without_xrefs;
%include "auto.hpp" %include "auto.hpp"

View File

@ -1,233 +1,233 @@
// SWIG chokes on the original declaration so it is replicated here // SWIG chokes on the original declaration so it is replicated here
typedef struct typedef struct
{ {
ulonglong ival; // 8: integer value ulonglong ival; // 8: integer value
ushort fval[6]; // 12: floating point value in the internal representation (see ieee.h) ushort fval[6]; // 12: floating point value in the internal representation (see ieee.h)
} regval_t; } regval_t;
%immutable dbg; %immutable dbg;
%include "dbg.hpp" %include "dbg.hpp"
%feature("director") DBG_Hooks; %feature("director") DBG_Hooks;
%inline %{ %inline %{
int idaapi DBG_Callback(void *ud, int notification_code, va_list va); int idaapi DBG_Callback(void *ud, int notification_code, va_list va);
class DBG_Hooks class DBG_Hooks
{ {
public: public:
virtual ~DBG_Hooks() {}; virtual ~DBG_Hooks() {};
bool hook() { return hook_to_notification_point(HT_DBG, DBG_Callback, this); }; bool hook() { return hook_to_notification_point(HT_DBG, DBG_Callback, this); };
bool unhook() { return unhook_from_notification_point(HT_DBG, DBG_Callback, this); }; bool unhook() { return unhook_from_notification_point(HT_DBG, DBG_Callback, this); };
/* Hook functions to be overridden in Python */ /* Hook functions to be overridden in Python */
virtual void dbg_process_start(process_id_t pid, virtual void dbg_process_start(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea, ea_t ea,
char *name, char *name,
ea_t base, ea_t base,
asize_t size) { }; asize_t size) { };
virtual void dbg_process_exit(process_id_t pid, virtual void dbg_process_exit(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea, ea_t ea,
int exit_code) { }; int exit_code) { };
virtual void dbg_process_attach(process_id_t pid, virtual void dbg_process_attach(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea, ea_t ea,
char *name, char *name,
ea_t base, ea_t base,
asize_t size) { }; asize_t size) { };
virtual void dbg_process_detach(process_id_t pid, virtual void dbg_process_detach(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea) { }; ea_t ea) { };
virtual void dbg_thread_start(process_id_t pid, virtual void dbg_thread_start(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea) { }; ea_t ea) { };
virtual void dbg_thread_exit(process_id_t pid, virtual void dbg_thread_exit(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea, ea_t ea,
int exit_code) { }; int exit_code) { };
virtual void dbg_library_load(process_id_t pid, virtual void dbg_library_load(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea, ea_t ea,
char *name, char *name,
ea_t base, ea_t base,
asize_t size) { }; asize_t size) { };
virtual void dbg_library_unload(process_id_t pid, virtual void dbg_library_unload(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea, ea_t ea,
char *libname) { }; char *libname) { };
virtual void dbg_information(process_id_t pid, virtual void dbg_information(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea, ea_t ea,
char *info) { }; char *info) { };
virtual int dbg_exception(process_id_t pid, virtual int dbg_exception(process_id_t pid,
thread_id_t tid, thread_id_t tid,
ea_t ea, ea_t ea,
int code, int code,
bool can_cont, bool can_cont,
ea_t exc_ea, ea_t exc_ea,
char *info) { return 0; }; char *info) { return 0; };
virtual void dbg_suspend_process(void) { }; virtual void dbg_suspend_process(void) { };
virtual int dbg_bpt(thread_id_t tid, ea_t breakpoint_ea) { return 0; }; virtual int dbg_bpt(thread_id_t tid, ea_t breakpoint_ea) { return 0; };
virtual int dbg_trace(thread_id_t tid, ea_t ip) { return 0; }; virtual int dbg_trace(thread_id_t tid, ea_t ip) { return 0; };
virtual void dbg_request_error(ui_notification_t failed_command, virtual void dbg_request_error(ui_notification_t failed_command,
dbg_notification_t failed_dbg_notification) { }; dbg_notification_t failed_dbg_notification) { };
virtual void dbg_step_into(void) { }; virtual void dbg_step_into(void) { };
virtual void dbg_step_over(void) { }; virtual void dbg_step_over(void) { };
virtual void dbg_run_to(thread_id_t tid) { }; virtual void dbg_run_to(thread_id_t tid) { };
virtual void dbg_step_until_ret(void) { }; virtual void dbg_step_until_ret(void) { };
}; };
int idaapi DBG_Callback(void *ud, int notification_code, va_list va) int idaapi DBG_Callback(void *ud, int notification_code, va_list va)
{ {
class DBG_Hooks *proxy = (class DBG_Hooks *)ud; class DBG_Hooks *proxy = (class DBG_Hooks *)ud;
debug_event_t *event; debug_event_t *event;
thread_id_t tid; thread_id_t tid;
int *warn; int *warn;
ea_t ip; ea_t ip;
ui_notification_t failed_command; ui_notification_t failed_command;
dbg_notification_t failed_dbg_notification; dbg_notification_t failed_dbg_notification;
ea_t breakpoint_ea; ea_t breakpoint_ea;
try { try {
switch (notification_code) switch (notification_code)
{ {
case dbg_process_start: case dbg_process_start:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
proxy->dbg_process_start(event->pid, proxy->dbg_process_start(event->pid,
event->tid, event->tid,
event->ea, event->ea,
event->modinfo.name, event->modinfo.name,
event->modinfo.base, event->modinfo.base,
event->modinfo.size); event->modinfo.size);
return 0; return 0;
case dbg_process_exit: case dbg_process_exit:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
proxy->dbg_process_exit(event->pid, proxy->dbg_process_exit(event->pid,
event->tid, event->tid,
event->ea, event->ea,
event->exit_code); event->exit_code);
return 0; return 0;
case dbg_process_attach: case dbg_process_attach:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
proxy->dbg_process_attach(event->pid, proxy->dbg_process_attach(event->pid,
event->tid, event->tid,
event->ea, event->ea,
event->modinfo.name, event->modinfo.name,
event->modinfo.base, event->modinfo.base,
event->modinfo.size); event->modinfo.size);
return 0; return 0;
case dbg_process_detach: case dbg_process_detach:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
proxy->dbg_process_detach(event->pid, proxy->dbg_process_detach(event->pid,
event->tid, event->tid,
event->ea); event->ea);
return 0; return 0;
case dbg_thread_start: case dbg_thread_start:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
proxy->dbg_thread_start(event->pid, proxy->dbg_thread_start(event->pid,
event->tid, event->tid,
event->ea); event->ea);
return 0; return 0;
case dbg_thread_exit: case dbg_thread_exit:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
proxy->dbg_thread_exit(event->pid, proxy->dbg_thread_exit(event->pid,
event->tid, event->tid,
event->ea, event->ea,
event->exit_code); event->exit_code);
return 0; return 0;
case dbg_library_load: case dbg_library_load:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
proxy->dbg_library_load(event->pid, proxy->dbg_library_load(event->pid,
event->tid, event->tid,
event->ea, event->ea,
event->modinfo.name, event->modinfo.name,
event->modinfo.base, event->modinfo.base,
event->modinfo.size); event->modinfo.size);
return 0; return 0;
case dbg_library_unload: case dbg_library_unload:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
proxy->dbg_library_unload(event->pid, proxy->dbg_library_unload(event->pid,
event->tid, event->tid,
event->ea, event->ea,
event->info); event->info);
return 0; return 0;
case dbg_information: case dbg_information:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
proxy->dbg_information(event->pid, proxy->dbg_information(event->pid,
event->tid, event->tid,
event->ea, event->ea,
event->info); event->info);
return 0; return 0;
case dbg_exception: case dbg_exception:
event = va_arg(va, debug_event_t *); event = va_arg(va, debug_event_t *);
warn = va_arg(va, int *); warn = va_arg(va, int *);
*warn = proxy->dbg_exception(event->pid, *warn = proxy->dbg_exception(event->pid,
event->tid, event->tid,
event->ea, event->ea,
event->exc.code, event->exc.code,
event->exc.can_cont, event->exc.can_cont,
event->exc.ea, event->exc.ea,
event->exc.info); event->exc.info);
return 0; return 0;
case dbg_suspend_process: case dbg_suspend_process:
proxy->dbg_suspend_process(); proxy->dbg_suspend_process();
return 0; return 0;
case dbg_bpt: case dbg_bpt:
tid = va_arg(va, thread_id_t); tid = va_arg(va, thread_id_t);
breakpoint_ea = va_arg(va, ea_t); breakpoint_ea = va_arg(va, ea_t);
warn = va_arg(va, int *); warn = va_arg(va, int *);
*warn = proxy->dbg_bpt(tid, breakpoint_ea); *warn = proxy->dbg_bpt(tid, breakpoint_ea);
return 0; return 0;
case dbg_trace: case dbg_trace:
tid = va_arg(va, thread_id_t); tid = va_arg(va, thread_id_t);
ip = va_arg(va, ea_t); ip = va_arg(va, ea_t);
return proxy->dbg_bpt(tid, ip); return proxy->dbg_bpt(tid, ip);
case dbg_request_error: case dbg_request_error:
failed_command = (ui_notification_t)va_arg(va, int); failed_command = (ui_notification_t)va_arg(va, int);
failed_dbg_notification = (dbg_notification_t)va_arg(va, int); failed_dbg_notification = (dbg_notification_t)va_arg(va, int);
proxy->dbg_request_error(failed_command, failed_dbg_notification); proxy->dbg_request_error(failed_command, failed_dbg_notification);
return 0; return 0;
case dbg_step_into: case dbg_step_into:
proxy->dbg_step_into(); proxy->dbg_step_into();
return 0; return 0;
case dbg_step_over: case dbg_step_over:
proxy->dbg_step_over(); proxy->dbg_step_over();
return 0; return 0;
case dbg_run_to: case dbg_run_to:
tid = va_arg(va, thread_id_t); tid = va_arg(va, thread_id_t);
proxy->dbg_run_to(tid); proxy->dbg_run_to(tid);
return 0; return 0;
case dbg_step_until_ret: case dbg_step_until_ret:
proxy->dbg_step_until_ret(); proxy->dbg_step_until_ret();
return 0; return 0;
} }
} }
catch (Swig::DirectorException &e) catch (Swig::DirectorException &e)
{ {
msg("Exception in IDP Hook function:\n"); msg("Exception in IDP Hook function:\n");
if (PyErr_Occurred()) if (PyErr_Occurred())
{ {
PyErr_Print(); PyErr_Print();
} }
} }
} }
%} %}

View File

@ -1,7 +1,7 @@
%ignore init_entries; %ignore init_entries;
%ignore term_entries; %ignore term_entries;
%ignore move_entries; %ignore move_entries;
%ignore set_entry_name; %ignore set_entry_name;
%include "entry.hpp" %include "entry.hpp"

View File

@ -1,61 +1,61 @@
%ignore extfun_t; %ignore extfun_t;
%ignore funcset_t; %ignore funcset_t;
%ignore IDCFuncs; %ignore IDCFuncs;
%ignore set_idc_func; %ignore set_idc_func;
%ignore VarLong; %ignore VarLong;
%ignore VarNum; %ignore VarNum;
%ignore VarString; %ignore VarString;
%ignore VarFloat; %ignore VarFloat;
%ignore VarFree; %ignore VarFree;
%ignore calcexpr_long; %ignore calcexpr_long;
%ignore Run; %ignore Run;
%ignore ExecuteLine; %ignore ExecuteLine;
%ignore ExecuteFile; %ignore ExecuteFile;
%ignore set_idc_func_body; %ignore set_idc_func_body;
%ignore get_idc_func_body; %ignore get_idc_func_body;
%ignore idc_stacksize; %ignore idc_stacksize;
%ignore idc_calldepth; %ignore idc_calldepth;
%ignore expr_printf; %ignore expr_printf;
%ignore expr_sprintf; %ignore expr_sprintf;
%ignore expr_printfer; %ignore expr_printfer;
%ignore idaapi init_idc; %ignore idaapi init_idc;
%ignore idaapi term_idc; %ignore idaapi term_idc;
%ignore del_idc_userfuncs; %ignore del_idc_userfuncs;
%ignore find_builtin_idc_func; %ignore find_builtin_idc_func;
%ignore idc_lx; %ignore idc_lx;
%cstring_output_maxstr_none(char *errbuf, size_t errbufsize); %cstring_output_maxstr_none(char *errbuf, size_t errbufsize);
/* Compile* functions return false when error so the return */ /* Compile* functions return false when error so the return */
/* value must be negated for the error string to be returned */ /* value must be negated for the error string to be returned */
%rename (CompileEx) CompileEx_wrap; %rename (CompileEx) CompileEx_wrap;
%inline %{ %inline %{
bool CompileEx_wrap(const char *file, bool del_macros, bool CompileEx_wrap(const char *file, bool del_macros,
char *errbuf, size_t errbufsize) char *errbuf, size_t errbufsize)
{ {
return !CompileEx(file, del_macros, errbuf, errbufsize); return !CompileEx(file, del_macros, errbuf, errbufsize);
} }
%} %}
%rename (Compile) Compile_wrap; %rename (Compile) Compile_wrap;
%inline %{ %inline %{
bool Compile_wrap(const char *file, char *errbuf, size_t errbufsize) bool Compile_wrap(const char *file, char *errbuf, size_t errbufsize)
{ {
return !Compile(file, errbuf, errbufsize); return !Compile(file, errbuf, errbufsize);
} }
%} %}
//%feature("compactdefaultargs") CompileLine; //%feature("compactdefaultargs") CompileLine;
%ignore CompileLine(const char *line, char *errbuf, size_t errbufsize, uval_t (idaapi*_getname)(const char *name)=NULL); %ignore CompileLine(const char *line, char *errbuf, size_t errbufsize, uval_t (idaapi*_getname)(const char *name)=NULL);
%rename (CompileLine) CompileLine_wrap; %rename (CompileLine) CompileLine_wrap;
%inline %{ %inline %{
bool CompileLine_wrap(const char *line, char *errbuf, size_t errbufsize) bool CompileLine_wrap(const char *line, char *errbuf, size_t errbufsize)
{ {
return !CompileLine(line, errbuf, errbufsize); return !CompileLine(line, errbuf, errbufsize);
} }
%} %}
%include "expr.hpp" %include "expr.hpp"

View File

@ -1,6 +1,6 @@
%ignore apply_fixup; %ignore apply_fixup;
%ignore convert_fixups; %ignore convert_fixups;
%ignore move_fixups; %ignore move_fixups;
%include "fixup.hpp" %include "fixup.hpp"

View File

@ -1,20 +1,20 @@
%ignore add_frame_spec_member; %ignore add_frame_spec_member;
%ignore del_stkvars; %ignore del_stkvars;
%ignore calc_frame_offset; %ignore calc_frame_offset;
%ignore read_regvars; %ignore read_regvars;
%ignore write_regvars; %ignore write_regvars;
%ignore del_regvars; %ignore del_regvars;
%ignore free_regvar; %ignore free_regvar;
%ignore gen_regvar_defs; %ignore gen_regvar_defs;
%ignore set_llabel; %ignore set_llabel;
%ignore get_llabel_ea; %ignore get_llabel_ea;
%ignore get_llabel; %ignore get_llabel;
%ignore read_llabels; %ignore read_llabels;
%ignore write_llabels; %ignore write_llabels;
%ignore del_llabels; %ignore del_llabels;
%ignore free_llabel; %ignore free_llabel;
%ignore read_stkpnts; %ignore read_stkpnts;
%ignore write_stkpnts; %ignore write_stkpnts;
%ignore del_stkpnts; %ignore del_stkpnts;
%include "frame.hpp" %include "frame.hpp"

View File

@ -1,121 +1,121 @@
%module(docstring="IDA Pro Plugin SDK API wrapper",directors="1") idaapi %module(docstring="IDA Pro Plugin SDK API wrapper",directors="1") idaapi
// Suppress 'previous definition of XX' warnings // Suppress 'previous definition of XX' warnings
#pragma SWIG nowarn=302 #pragma SWIG nowarn=302
// Enable automatic docstring generation // Enable automatic docstring generation
%feature(autodoc); %feature(autodoc);
%{ %{
#include <Python.h> #include <Python.h>
#define USE_DANGEROUS_FUNCTIONS 1 #define USE_DANGEROUS_FUNCTIONS 1
#ifdef HAVE_SSIZE_T #ifdef HAVE_SSIZE_T
#define _SSIZE_T_DEFINED 1 #define _SSIZE_T_DEFINED 1
#endif #endif
#include "ida.hpp" #include "ida.hpp"
#include "idp.hpp" #include "idp.hpp"
#include "allins.hpp" #include "allins.hpp"
#include "auto.hpp" #include "auto.hpp"
#include "bytes.hpp" #include "bytes.hpp"
#include "dbg.hpp" #include "dbg.hpp"
#include "diskio.hpp" #include "diskio.hpp"
#include "entry.hpp" #include "entry.hpp"
#include "enum.hpp" #include "enum.hpp"
#include "expr.hpp" #include "expr.hpp"
#include "frame.hpp" #include "frame.hpp"
#include "fixup.hpp" #include "fixup.hpp"
#include "funcs.hpp" #include "funcs.hpp"
#include "idd.hpp" #include "idd.hpp"
#include "ints.hpp" #include "ints.hpp"
#include "kernwin.hpp" #include "kernwin.hpp"
#include "lines.hpp" #include "lines.hpp"
#include "loader.hpp" #include "loader.hpp"
#include "moves.hpp" #include "moves.hpp"
#include "netnode.hpp" #include "netnode.hpp"
#include "nalt.hpp" #include "nalt.hpp"
#include "name.hpp" #include "name.hpp"
#include "offset.hpp" #include "offset.hpp"
#include "queue.hpp" #include "queue.hpp"
#include "search.hpp" #include "search.hpp"
#include "srarea.hpp" #include "srarea.hpp"
#include "strlist.hpp" #include "strlist.hpp"
#include "struct.hpp" #include "struct.hpp"
#include "typeinf.hpp" #include "typeinf.hpp"
#include "ua.hpp" #include "ua.hpp"
#include "xref.hpp" #include "xref.hpp"
%} %}
%constant ea_t BADADDR = 0xFFFFFFFF; %constant ea_t BADADDR = 0xFFFFFFFF;
%constant sel_t BADSEL = 0xFFFFFFFF; %constant sel_t BADSEL = 0xFFFFFFFF;
// Help SWIG to figure out the ulonglong type // Help SWIG to figure out the ulonglong type
#ifdef SWIGWIN #ifdef SWIGWIN
typedef unsigned __int64 ulonglong; typedef unsigned __int64 ulonglong;
typedef __int64 longlong; typedef __int64 longlong;
#else #else
typedef unsigned long long ulonglong; typedef unsigned long long ulonglong;
typedef long long longlong; typedef long long longlong;
#endif #endif
%include "typemaps.i" %include "typemaps.i"
%include "cstring.i" %include "cstring.i"
%include "carrays.i" %include "carrays.i"
%include "cpointer.i" %include "cpointer.i"
%include "typeconv.i" %include "typeconv.i"
%include "pro.h" %include "pro.h"
// Convert all of these // Convert all of these
%cstring_output_maxstr_none(char *buf, size_t bufsize); %cstring_output_maxstr_none(char *buf, size_t bufsize);
%array_class(uchar, uchar_array); %array_class(uchar, uchar_array);
%array_class(tid_t, tid_array); %array_class(tid_t, tid_array);
%array_class(ea_t, ea_array); %array_class(ea_t, ea_array);
%array_class(sel_t, sel_array); %array_class(sel_t, sel_array);
%pointer_class(int, int_pointer); %pointer_class(int, int_pointer);
%pointer_class(ea_t, ea_pointer); %pointer_class(ea_t, ea_pointer);
%pointer_class(sval_t, sval_pointer); %pointer_class(sval_t, sval_pointer);
%pointer_class(sel_t, sel_pointer); %pointer_class(sel_t, sel_pointer);
%include "ida.i" %include "ida.i"
%include "idd.hpp" %include "idd.hpp"
%include "idp.i" %include "idp.i"
%include "netnode.i" %include "netnode.i"
%include "nalt.i" %include "nalt.i"
%include "allins.i" %include "allins.i"
%include "area.hpp" %include "area.hpp"
%include "auto.i" %include "auto.i"
%include "bytes.i" %include "bytes.i"
%include "dbg.i" %include "dbg.i"
%include "diskio.i" %include "diskio.i"
%include "entry.i" %include "entry.i"
%include "enum.i" %include "enum.i"
%include "expr.i" %include "expr.i"
%include "fixup.i" %include "fixup.i"
%include "frame.i" %include "frame.i"
%include "funcs.i" %include "funcs.i"
%inline { %inline {
/* Small wrapper to get the inf structure */ /* Small wrapper to get the inf structure */
idainfo *get_inf_structure(void) idainfo *get_inf_structure(void)
{ {
return &inf; return &inf;
} }
} }
%include "ints.i" %include "ints.i"
%include "kernwin.i" %include "kernwin.i"
%include "lines.i" %include "lines.i"
%include "loader.i" %include "loader.i"
%include "moves.i" %include "moves.i"
%include "name.i" %include "name.i"
%include "offset.i" %include "offset.i"
%include "queue.i" %include "queue.i"
%include "search.i" %include "search.i"
%include "segment.i" %include "segment.i"
%include "srarea.i" %include "srarea.i"
%include "strlist.i" %include "strlist.i"
%include "struct.i" %include "struct.i"
%include "typeinf.i" %include "typeinf.i"
%include "ua.i" %include "ua.i"
%include "xref.i" %include "xref.i"

View File

@ -1,253 +1,253 @@
%ignore gen_idb_event; %ignore gen_idb_event;
// Ignore the function pointers // Ignore the function pointers
%ignore asm_t::checkarg_dispatch; %ignore asm_t::checkarg_dispatch;
%ignore asm_t::func_header; %ignore asm_t::func_header;
%ignore asm_t::func_footer; %ignore asm_t::func_footer;
%ignore asm_t::get_type_name; %ignore asm_t::get_type_name;
%ignore processor_t::notify; %ignore processor_t::notify;
%ignore processor_t::header; %ignore processor_t::header;
%ignore processor_t::footer; %ignore processor_t::footer;
%ignore processor_t::segstart; %ignore processor_t::segstart;
%ignore processor_t::segend; %ignore processor_t::segend;
%ignore processor_t::assumes; %ignore processor_t::assumes;
%ignore processor_t::u_ana; %ignore processor_t::u_ana;
%ignore processor_t::u_emu; %ignore processor_t::u_emu;
%ignore processor_t::u_out; %ignore processor_t::u_out;
%ignore processor_t::u_outop; %ignore processor_t::u_outop;
%ignore processor_t::d_out; %ignore processor_t::d_out;
%ignore processor_t::cmp_opnd; %ignore processor_t::cmp_opnd;
%ignore processor_t::can_have_type; %ignore processor_t::can_have_type;
%ignore processor_t::getreg; %ignore processor_t::getreg;
%ignore processor_t::is_far_jump; %ignore processor_t::is_far_jump;
%ignore processor_t::translate; %ignore processor_t::translate;
%ignore processor_t::realcvt; %ignore processor_t::realcvt;
%ignore processor_t::is_switch; %ignore processor_t::is_switch;
%ignore processor_t::gen_map_file; %ignore processor_t::gen_map_file;
%ignore processor_t::extract_address; %ignore processor_t::extract_address;
%ignore processor_t::is_sp_based; %ignore processor_t::is_sp_based;
%ignore processor_t::create_func_frame; %ignore processor_t::create_func_frame;
%ignore processor_t::get_frame_retsize; %ignore processor_t::get_frame_retsize;
%ignore processor_t::gen_stkvar_def; %ignore processor_t::gen_stkvar_def;
%ignore processor_t::u_outspec; %ignore processor_t::u_outspec;
%ignore processor_t::is_align_insn; %ignore processor_t::is_align_insn;
%include "idp.hpp" %include "idp.hpp"
%feature("director") IDB_Hooks; %feature("director") IDB_Hooks;
%inline %{ %inline %{
int idaapi IDB_Callback(void *ud, int notification_code, va_list va); int idaapi IDB_Callback(void *ud, int notification_code, va_list va);
class IDB_Hooks class IDB_Hooks
{ {
public: public:
virtual ~IDB_Hooks() {}; virtual ~IDB_Hooks() {};
bool hook() { return hook_to_notification_point(HT_IDB, IDB_Callback, this); } bool hook() { return hook_to_notification_point(HT_IDB, IDB_Callback, this); }
bool unhook() { return unhook_from_notification_point(HT_IDB, IDB_Callback, this); } bool unhook() { return unhook_from_notification_point(HT_IDB, IDB_Callback, this); }
/* Hook functions to override in Python */ /* Hook functions to override in Python */
virtual int byte_patched(ea_t ea) { return 0; }; virtual int byte_patched(ea_t ea) { return 0; };
virtual int cmt_changed(ea_t, bool repeatable_cmt) { return 0; }; virtual int cmt_changed(ea_t, bool repeatable_cmt) { return 0; };
virtual int ti_changed(ea_t ea, const type_t *type, const p_list *fnames) { msg("ti_changed hook not supported yet\n"); return 0; }; virtual int ti_changed(ea_t ea, const type_t *type, const p_list *fnames) { msg("ti_changed hook not supported yet\n"); return 0; };
virtual int op_ti_changed(ea_t ea, int n, const type_t *type, const p_list *fnames) { msg("op_ti_changed hook not supported yet\n"); return 0; }; virtual int op_ti_changed(ea_t ea, int n, const type_t *type, const p_list *fnames) { msg("op_ti_changed hook not supported yet\n"); return 0; };
virtual int op_type_changed(ea_t ea, int n) { return 0; }; virtual int op_type_changed(ea_t ea, int n) { return 0; };
virtual int enum_created(enum_t id) { return 0; }; virtual int enum_created(enum_t id) { return 0; };
virtual int enum_deleted(enum_t id) { return 0; }; virtual int enum_deleted(enum_t id) { return 0; };
virtual int enum_bf_changed(enum_t id) { return 0; }; virtual int enum_bf_changed(enum_t id) { return 0; };
virtual int enum_renamed(enum_t id) { return 0; }; virtual int enum_renamed(enum_t id) { return 0; };
virtual int enum_cmt_changed(enum_t id) { return 0; }; virtual int enum_cmt_changed(enum_t id) { return 0; };
virtual int enum_const_created(enum_t id, const_t cid) { return 0; }; virtual int enum_const_created(enum_t id, const_t cid) { return 0; };
virtual int enum_const_deleted(enum_t id, const_t cid) { return 0; }; virtual int enum_const_deleted(enum_t id, const_t cid) { return 0; };
virtual int struc_created(tid_t struc_id) { return 0; }; virtual int struc_created(tid_t struc_id) { return 0; };
virtual int struc_deleted(tid_t struc_id) { return 0; }; virtual int struc_deleted(tid_t struc_id) { return 0; };
virtual int struc_renamed(struc_t *sptr) { return 0; }; virtual int struc_renamed(struc_t *sptr) { return 0; };
virtual int struc_expanded(struc_t *sptr) { return 0; }; virtual int struc_expanded(struc_t *sptr) { return 0; };
virtual int struc_cmt_changed(tid_t struc_id) { return 0; }; virtual int struc_cmt_changed(tid_t struc_id) { return 0; };
virtual int struc_member_created(struc_t *sptr, member_t *mptr) { return 0; }; virtual int struc_member_created(struc_t *sptr, member_t *mptr) { return 0; };
virtual int struc_member_deleted(struc_t *sptr, tid_t member_id) { return 0; }; virtual int struc_member_deleted(struc_t *sptr, tid_t member_id) { return 0; };
virtual int struc_member_renamed(struc_t *sptr, member_t *mptr) { return 0; }; virtual int struc_member_renamed(struc_t *sptr, member_t *mptr) { return 0; };
virtual int struc_member_changed(struc_t *sptr, member_t *mptr) { return 0; }; virtual int struc_member_changed(struc_t *sptr, member_t *mptr) { return 0; };
virtual int thunk_func_created(func_t *pfn) { return 0; }; virtual int thunk_func_created(func_t *pfn) { return 0; };
virtual int func_tail_appended(func_t *pfn, func_t *tail) { return 0; }; virtual int func_tail_appended(func_t *pfn, func_t *tail) { return 0; };
virtual int func_tail_removed(func_t *pfn, ea_t tail_ea) { return 0; }; virtual int func_tail_removed(func_t *pfn, ea_t tail_ea) { return 0; };
virtual int tail_owner_changed(func_t *tail, ea_t owner_func) { return 0; }; virtual int tail_owner_changed(func_t *tail, ea_t owner_func) { return 0; };
virtual int func_noret_changed(func_t *pfn) { return 0; }; virtual int func_noret_changed(func_t *pfn) { return 0; };
virtual int segm_added(segment_t *s) { return 0; }; virtual int segm_added(segment_t *s) { return 0; };
virtual int segm_deleted(ea_t startEA) { return 0; }; virtual int segm_deleted(ea_t startEA) { return 0; };
virtual int segm_start_changed(segment_t *s) { return 0; }; virtual int segm_start_changed(segment_t *s) { return 0; };
virtual int segm_end_changed(segment_t *s) { return 0; }; virtual int segm_end_changed(segment_t *s) { return 0; };
virtual int segm_moved(ea_t from, ea_t to, asize_t size) { return 0; }; virtual int segm_moved(ea_t from, ea_t to, asize_t size) { return 0; };
}; };
int idaapi IDB_Callback(void *ud, int notification_code, va_list va) int idaapi IDB_Callback(void *ud, int notification_code, va_list va)
{ {
class IDB_Hooks *proxy = (class IDB_Hooks *)ud; class IDB_Hooks *proxy = (class IDB_Hooks *)ud;
ea_t ea, ea2; ea_t ea, ea2;
bool repeatable_cmt; bool repeatable_cmt;
type_t *type; type_t *type;
/* p_list *fnames; */ /* p_list *fnames; */
int n; int n;
enum_t id; enum_t id;
const_t cid; const_t cid;
tid_t struc_id; tid_t struc_id;
struc_t *sptr; struc_t *sptr;
member_t *mptr; member_t *mptr;
tid_t member_id; tid_t member_id;
func_t *pfn; func_t *pfn;
func_t *tail; func_t *tail;
segment_t *seg; segment_t *seg;
asize_t size; asize_t size;
try { try {
switch (notification_code) switch (notification_code)
{ {
case idb_event::byte_patched: case idb_event::byte_patched:
ea = va_arg(va, ea_t); ea = va_arg(va, ea_t);
return proxy->byte_patched(ea); return proxy->byte_patched(ea);
case idb_event::cmt_changed: case idb_event::cmt_changed:
ea = va_arg(va, ea_t); ea = va_arg(va, ea_t);
repeatable_cmt = va_arg(va, int); repeatable_cmt = va_arg(va, int);
return proxy->cmt_changed(ea, repeatable_cmt); return proxy->cmt_changed(ea, repeatable_cmt);
#if 0 #if 0
case idb_event::ti_changed: case idb_event::ti_changed:
ea = va_arg(va, ea_t); ea = va_arg(va, ea_t);
type = va_arg(va, type_t *); type = va_arg(va, type_t *);
fnames = va_arg(va, fnames); fnames = va_arg(va, fnames);
return proxy->ti_changed(ea, type, fnames); return proxy->ti_changed(ea, type, fnames);
case idb_event::op_ti_changed: case idb_event::op_ti_changed:
ea = va_arg(va, ea_t); ea = va_arg(va, ea_t);
n = va_arg(va, int); n = va_arg(va, int);
type = va_arg(va, type_t *); type = va_arg(va, type_t *);
fnames = va_arg(va, fnames); fnames = va_arg(va, fnames);
return proxy->op_ti_changed(ea, n, type, fnames); return proxy->op_ti_changed(ea, n, type, fnames);
#endif #endif
case idb_event::op_type_changed: case idb_event::op_type_changed:
ea = va_arg(va, ea_t); ea = va_arg(va, ea_t);
n = va_arg(va, int); n = va_arg(va, int);
return proxy->op_type_changed(ea, n); return proxy->op_type_changed(ea, n);
case idb_event::enum_created: case idb_event::enum_created:
id = va_arg(va, enum_t); id = va_arg(va, enum_t);
return proxy->enum_created(id); return proxy->enum_created(id);
case idb_event::enum_deleted: case idb_event::enum_deleted:
id = va_arg(va, enum_t); id = va_arg(va, enum_t);
return proxy->enum_deleted(id); return proxy->enum_deleted(id);
case idb_event::enum_bf_changed: case idb_event::enum_bf_changed:
id = va_arg(va, enum_t); id = va_arg(va, enum_t);
return proxy->enum_bf_changed(id); return proxy->enum_bf_changed(id);
case idb_event::enum_cmt_changed: case idb_event::enum_cmt_changed:
id = va_arg(va, enum_t); id = va_arg(va, enum_t);
return proxy->enum_cmt_changed(id); return proxy->enum_cmt_changed(id);
case idb_event::enum_const_created: case idb_event::enum_const_created:
id = va_arg(va, enum_t); id = va_arg(va, enum_t);
cid = va_arg(va, const_t); cid = va_arg(va, const_t);
return proxy->enum_const_created(id, cid); return proxy->enum_const_created(id, cid);
case idb_event::enum_const_deleted: case idb_event::enum_const_deleted:
id = va_arg(va, enum_t); id = va_arg(va, enum_t);
cid = va_arg(va, const_t); cid = va_arg(va, const_t);
return proxy->enum_const_deleted(id, cid); return proxy->enum_const_deleted(id, cid);
case idb_event::struc_created: case idb_event::struc_created:
struc_id = va_arg(va, tid_t); struc_id = va_arg(va, tid_t);
return proxy->struc_created(struc_id); return proxy->struc_created(struc_id);
case idb_event::struc_deleted: case idb_event::struc_deleted:
struc_id = va_arg(va, tid_t); struc_id = va_arg(va, tid_t);
return proxy->struc_deleted(struc_id); return proxy->struc_deleted(struc_id);
case idb_event::struc_renamed: case idb_event::struc_renamed:
sptr = va_arg(va, struc_t *); sptr = va_arg(va, struc_t *);
return proxy->struc_renamed(sptr); return proxy->struc_renamed(sptr);
case idb_event::struc_expanded: case idb_event::struc_expanded:
sptr = va_arg(va, struc_t *); sptr = va_arg(va, struc_t *);
return proxy->struc_expanded(sptr); return proxy->struc_expanded(sptr);
case idb_event::struc_cmt_changed: case idb_event::struc_cmt_changed:
struc_id = va_arg(va, tid_t); struc_id = va_arg(va, tid_t);
return proxy->struc_cmt_changed(struc_id); return proxy->struc_cmt_changed(struc_id);
case idb_event::struc_member_created: case idb_event::struc_member_created:
sptr = va_arg(va, struc_t *); sptr = va_arg(va, struc_t *);
mptr = va_arg(va, member_t *); mptr = va_arg(va, member_t *);
return proxy->struc_member_created(sptr, mptr); return proxy->struc_member_created(sptr, mptr);
case idb_event::struc_member_deleted: case idb_event::struc_member_deleted:
sptr = va_arg(va, struc_t *); sptr = va_arg(va, struc_t *);
member_id = va_arg(va, tid_t); member_id = va_arg(va, tid_t);
return proxy->struc_member_deleted(sptr, member_id); return proxy->struc_member_deleted(sptr, member_id);
case idb_event::struc_member_renamed: case idb_event::struc_member_renamed:
sptr = va_arg(va, struc_t *); sptr = va_arg(va, struc_t *);
mptr = va_arg(va, member_t *); mptr = va_arg(va, member_t *);
return proxy->struc_member_renamed(sptr, mptr); return proxy->struc_member_renamed(sptr, mptr);
case idb_event::struc_member_changed: case idb_event::struc_member_changed:
sptr = va_arg(va, struc_t *); sptr = va_arg(va, struc_t *);
mptr = va_arg(va, member_t *); mptr = va_arg(va, member_t *);
return proxy->struc_member_changed(sptr, mptr); return proxy->struc_member_changed(sptr, mptr);
case idb_event::thunk_func_created: case idb_event::thunk_func_created:
pfn = va_arg(va, func_t *); pfn = va_arg(va, func_t *);
return proxy->thunk_func_created(pfn); return proxy->thunk_func_created(pfn);
case idb_event::func_tail_appended: case idb_event::func_tail_appended:
pfn = va_arg(va, func_t *); pfn = va_arg(va, func_t *);
tail = va_arg(va, func_t *); tail = va_arg(va, func_t *);
return proxy->func_tail_appended(pfn, tail); return proxy->func_tail_appended(pfn, tail);
case idb_event::func_tail_removed: case idb_event::func_tail_removed:
pfn = va_arg(va, func_t *); pfn = va_arg(va, func_t *);
ea = va_arg(va, ea_t); ea = va_arg(va, ea_t);
return proxy->func_tail_removed(pfn, ea); return proxy->func_tail_removed(pfn, ea);
case idb_event::tail_owner_changed: case idb_event::tail_owner_changed:
tail = va_arg(va, func_t *); tail = va_arg(va, func_t *);
ea = va_arg(va, ea_t); ea = va_arg(va, ea_t);
return proxy->tail_owner_changed(tail, ea); return proxy->tail_owner_changed(tail, ea);
case idb_event::func_noret_changed: case idb_event::func_noret_changed:
pfn = va_arg(va, func_t *); pfn = va_arg(va, func_t *);
return proxy->func_noret_changed(pfn); return proxy->func_noret_changed(pfn);
case idb_event::segm_added: case idb_event::segm_added:
seg = va_arg(va, segment_t *); seg = va_arg(va, segment_t *);
return proxy->segm_added(seg); return proxy->segm_added(seg);
case idb_event::segm_deleted: case idb_event::segm_deleted:
ea = va_arg(va, ea_t); ea = va_arg(va, ea_t);
return proxy->segm_deleted(ea); return proxy->segm_deleted(ea);
case idb_event::segm_start_changed: case idb_event::segm_start_changed:
seg = va_arg(va, segment_t *); seg = va_arg(va, segment_t *);
return proxy->segm_start_changed(seg); return proxy->segm_start_changed(seg);
case idb_event::segm_end_changed: case idb_event::segm_end_changed:
seg = va_arg(va, segment_t *); seg = va_arg(va, segment_t *);
return proxy->segm_end_changed(seg); return proxy->segm_end_changed(seg);
case idb_event::segm_moved: case idb_event::segm_moved:
ea = va_arg(va, ea_t); ea = va_arg(va, ea_t);
ea2 = va_arg(va, ea_t); ea2 = va_arg(va, ea_t);
size = va_arg(va, asize_t); size = va_arg(va, asize_t);
return proxy->segm_moved(ea, ea2, size); return proxy->segm_moved(ea, ea2, size);
} }
} }
catch (Swig::DirectorException &e) catch (Swig::DirectorException &e)
{ {
msg("Exception in IDP Hook function:\n"); msg("Exception in IDP Hook function:\n");
if (PyErr_Occurred()) if (PyErr_Occurred())
{ {
PyErr_Print(); PyErr_Print();
} }
} }
} }
%} %}

View File

@ -1,6 +1,6 @@
// Kernel-only symbols // Kernel-only symbols
%ignore init_predefs; %ignore init_predefs;
%ignore term_predefs; %ignore term_predefs;
%include "ints.i" %include "ints.i"

View File

@ -1,63 +1,63 @@
// Convert this for ver 4.8 tag_remove() // Convert this for ver 4.8 tag_remove()
%cstring_output_maxstr_none(char *buf, int bufsize); %cstring_output_maxstr_none(char *buf, int bufsize);
// FIXME: These should be fixed // FIXME: These should be fixed
%ignore tag_on; %ignore tag_on;
%ignore tag_off; %ignore tag_off;
%ignore tag_addchr; %ignore tag_addchr;
%ignore tag_addstr; %ignore tag_addstr;
%ignore tag_addr; %ignore tag_addr;
%ignore tag_advance; %ignore tag_advance;
%ignore tag_skipcodes; %ignore tag_skipcodes;
%ignore tag_skipcode; %ignore tag_skipcode;
%ignore set_user_defined_prefix; %ignore set_user_defined_prefix;
%ignore get_user_defined_prefix; %ignore get_user_defined_prefix;
// Ignore va_list versions // Ignore va_list versions
%ignore printf_line_v; %ignore printf_line_v;
%ignore gen_colored_cmt_line_v; %ignore gen_colored_cmt_line_v;
%ignore gen_cmt_line_v; %ignore gen_cmt_line_v;
%ignore add_long_cmt_v; %ignore add_long_cmt_v;
%ignore describex; %ignore describex;
// Kernel-only and unexported symbols // Kernel-only and unexported symbols
%ignore init_sourcefiles; %ignore init_sourcefiles;
%ignore save_sourcefiles; %ignore save_sourcefiles;
%ignore term_sourcefiles; %ignore term_sourcefiles;
%ignore move_sourcefiles; %ignore move_sourcefiles;
%ignore gen_xref_lines; %ignore gen_xref_lines;
%ignore ml_getcmt_t; %ignore ml_getcmt_t;
%ignore ml_getnam_t; %ignore ml_getnam_t;
%ignore ml_genxrf_t; %ignore ml_genxrf_t;
%ignore ml_saver_t; %ignore ml_saver_t;
%ignore setup_makeline; %ignore setup_makeline;
%ignore MAKELINE_NONE; %ignore MAKELINE_NONE;
%ignore MAKELINE_BINPREF; %ignore MAKELINE_BINPREF;
%ignore MAKELINE_VOID; %ignore MAKELINE_VOID;
%ignore MAKELINE_STACK; %ignore MAKELINE_STACK;
%ignore save_line_in_array; %ignore save_line_in_array;
%ignore init_lines_array; %ignore init_lines_array;
%ignore finish_makeline; %ignore finish_makeline;
%ignore generate_disassembly; %ignore generate_disassembly;
%ignore gen_labeled_line; %ignore gen_labeled_line;
%ignore gen_lname_line; %ignore gen_lname_line;
%ignore makeline_producer_t; %ignore makeline_producer_t;
%ignore set_makeline_producer; %ignore set_makeline_producer;
%ignore closing_comment; %ignore closing_comment;
%ignore close_comment; %ignore close_comment;
%ignore copy_extra_lines; %ignore copy_extra_lines;
%ignore ExtraLines; %ignore ExtraLines;
%ignore ExtraKill; %ignore ExtraKill;
%ignore ExtraFree; %ignore ExtraFree;
%ignore Dumper; %ignore Dumper;
%ignore init_lines; %ignore init_lines;
%ignore save_lines; %ignore save_lines;
%ignore term_lines; %ignore term_lines;
%ignore gl_namedone; %ignore gl_namedone;
%ignore data_as_stack; %ignore data_as_stack;
%ignore calc_stack_alignment; %ignore calc_stack_alignment;
%ignore align_down_to_stack; %ignore align_down_to_stack;
%ignore align_up_to_stack; %ignore align_up_to_stack;
%ignore remove_spaces; %ignore remove_spaces;
%include "lines.hpp" %include "lines.hpp"
%clear(char *buf, int bufsize); %clear(char *buf, int bufsize);

View File

@ -1,11 +1,11 @@
// Ignore kernel only symbols // Ignore kernel only symbols
%ignore init_marks; %ignore init_marks;
%ignore term_marks; %ignore term_marks;
%ignore change_jumps_stack_format; %ignore change_jumps_stack_format;
%ignore move_marks; %ignore move_marks;
%ignore loc_gtag; %ignore loc_gtag;
%ignore DEFINE_CURLOC_HELPERS; %ignore DEFINE_CURLOC_HELPERS;
%ignore DEFINE_LOCATION_HELPERS; %ignore DEFINE_LOCATION_HELPERS;
%include "moves.hpp" %include "moves.hpp"

View File

@ -1,33 +1,33 @@
%cstring_output_maxstr_none(char *buf, int bufsize); %cstring_output_maxstr_none(char *buf, int bufsize);
%cstring_bounded_output(char *dstname, MAXSTR); %cstring_bounded_output(char *dstname, MAXSTR);
%cstring_bounded_output(char *buf, MAXSTR); %cstring_bounded_output(char *buf, MAXSTR);
// This is for get_name_value's output value // This is for get_name_value's output value
%apply unsigned long *OUTPUT { uval_t *value }; %apply unsigned long *OUTPUT { uval_t *value };
// FIXME: These should be fixed // FIXME: These should be fixed
%ignore append_struct_fields; %ignore append_struct_fields;
%ignore get_struct_operand; %ignore get_struct_operand;
%ignore set_debug_names; %ignore set_debug_names;
%ignore get_debug_name; %ignore get_debug_name;
%ignore nameVa; %ignore nameVa;
// Unexported & kernel-only // Unexported & kernel-only
%ignore get_short_name; %ignore get_short_name;
%ignore get_long_name; %ignore get_long_name;
%ignore get_colored_short_name; %ignore get_colored_short_name;
%ignore get_colored_long_name; %ignore get_colored_long_name;
%ignore addDummyName; %ignore addDummyName;
%ignore convert_debug_names_to_normal; %ignore convert_debug_names_to_normal;
%ignore convert_name_formats; %ignore convert_name_formats;
%ignore showhide_name; %ignore showhide_name;
%ignore clear_lname_bit; %ignore clear_lname_bit;
%ignore fix_new_name; %ignore fix_new_name;
%ignore rename; %ignore rename;
%ignore move_names; %ignore move_names;
%ignore is_exit_name; %ignore is_exit_name;
%ignore dummy_name_ea; %ignore dummy_name_ea;
%include "name.hpp" %include "name.hpp"

View File

@ -1,84 +1,84 @@
// Ignore kernel only & unexported symbols // Ignore kernel only & unexported symbols
%ignore netlink; %ignore netlink;
%ignore RootNode; %ignore RootNode;
%ignore for_all_supvals; %ignore for_all_supvals;
%ignore netErrorHandler; %ignore netErrorHandler;
%ignore netnode_key_count; %ignore netnode_key_count;
%ignore netnode_check; %ignore netnode_check;
%ignore netnode_kill; %ignore netnode_kill;
%ignore netnode_start; %ignore netnode_start;
%ignore netnode_end; %ignore netnode_end;
%ignore netnode_next; %ignore netnode_next;
%ignore netnode_prev; %ignore netnode_prev;
%ignore netnode_name; %ignore netnode_name;
%ignore netnode_rename; %ignore netnode_rename;
%ignore netnode_valobj; %ignore netnode_valobj;
%ignore netnode_valstr; %ignore netnode_valstr;
%ignore netnode_set; %ignore netnode_set;
%ignore netnode_delvalue; %ignore netnode_delvalue;
%ignore netnode_altval; %ignore netnode_altval;
%ignore netnode_charval; %ignore netnode_charval;
%ignore netnode_altval_idx8; %ignore netnode_altval_idx8;
%ignore netnode_charval_idx8; %ignore netnode_charval_idx8;
%ignore netnode_supval; %ignore netnode_supval;
%ignore netnode_supstr; %ignore netnode_supstr;
%ignore netnode_supset; %ignore netnode_supset;
%ignore netnode_supdel; %ignore netnode_supdel;
%ignore netnode_sup1st; %ignore netnode_sup1st;
%ignore netnode_supnxt; %ignore netnode_supnxt;
%ignore netnode_suplast; %ignore netnode_suplast;
%ignore netnode_supprev; %ignore netnode_supprev;
%ignore netnode_supval_idx8; %ignore netnode_supval_idx8;
%ignore netnode_supstr_idx8; %ignore netnode_supstr_idx8;
%ignore netnode_supset_idx8; %ignore netnode_supset_idx8;
%ignore netnode_supdel_idx8; %ignore netnode_supdel_idx8;
%ignore netnode_sup1st_idx8; %ignore netnode_sup1st_idx8;
%ignore netnode_supnxt_idx8; %ignore netnode_supnxt_idx8;
%ignore netnode_suplast_idx8; %ignore netnode_suplast_idx8;
%ignore netnode_supprev_idx8; %ignore netnode_supprev_idx8;
%ignore netnode_supdel_all; %ignore netnode_supdel_all;
%ignore netnode_hashval; %ignore netnode_hashval;
%ignore netnode_hashstr; %ignore netnode_hashstr;
%ignore netnode_hashval_long; %ignore netnode_hashval_long;
%ignore netnode_hashset; %ignore netnode_hashset;
%ignore netnode_hashdel; %ignore netnode_hashdel;
%ignore netnode_hash1st; %ignore netnode_hash1st;
%ignore netnode_hashnxt; %ignore netnode_hashnxt;
%ignore netnode_hashlast; %ignore netnode_hashlast;
%ignore netnode_hashprev; %ignore netnode_hashprev;
%ignore netnode_blobsize; %ignore netnode_blobsize;
%ignore netnode_getblob; %ignore netnode_getblob;
%ignore netnode_setblob; %ignore netnode_setblob;
%ignore netnode_delblob; %ignore netnode_delblob;
%ignore netnode_inited; %ignore netnode_inited;
%ignore netnode_copy; %ignore netnode_copy;
%ignore netnode_altshift; %ignore netnode_altshift;
%ignore netnode_charshift; %ignore netnode_charshift;
%ignore netnode_supshift; %ignore netnode_supshift;
%ignore netnode_altadjust; %ignore netnode_altadjust;
%ignore netnode_exist; %ignore netnode_exist;
%ignore netnode::truncate_zero_pages; %ignore netnode::truncate_zero_pages;
%ignore netnode::append_zero_pages; %ignore netnode::append_zero_pages;
%ignore netnode::createbase; %ignore netnode::createbase;
%ignore netnode::checkbase; %ignore netnode::checkbase;
%ignore netnode::set_close_flag; %ignore netnode::set_close_flag;
%ignore netnode::reserve_nodes; %ignore netnode::reserve_nodes;
%ignore netnode::validate; %ignore netnode::validate;
%ignore netnode::upgrade; %ignore netnode::upgrade;
%ignore netnode::compress; %ignore netnode::compress;
%ignore netnode::inited; %ignore netnode::inited;
%ignore netnode::init; %ignore netnode::init;
%ignore netnode::flush; %ignore netnode::flush;
%ignore netnode::term; %ignore netnode::term;
%ignore netnode::killbase; %ignore netnode::killbase;
%ignore netnode::getdrive; %ignore netnode::getdrive;
%ignore netnode::getgraph; %ignore netnode::getgraph;
%ignore netnode::registerbase; %ignore netnode::registerbase;
%ignore netnode::setbase; %ignore netnode::setbase;
%ignore netnode::altadjust; %ignore netnode::altadjust;
%include "netnode.hpp" %include "netnode.hpp"

View File

@ -1,3 +1,3 @@
%ignore calc_probable_base; %ignore calc_probable_base;
%include "offset.hpp" %include "offset.hpp"

View File

@ -1,12 +1,12 @@
// TODO: This could be wrapped. // TODO: This could be wrapped.
%ignore QueueGet; %ignore QueueGet;
// Kernel-only & unexported symbols // Kernel-only & unexported symbols
%ignore QueueDel; %ignore QueueDel;
%ignore init_queue; %ignore init_queue;
%ignore save_queue; %ignore save_queue;
%ignore term_queue; %ignore term_queue;
%ignore move_problems; %ignore move_problems;
%ignore queue_del; %ignore queue_del;
%include "queue.hpp" %include "queue.hpp"

View File

@ -1,14 +1,14 @@
%apply int * OUTPUT { int *opnum }; %apply int * OUTPUT { int *opnum };
// Do not generate overloaded versions for default arguments // Do not generate overloaded versions for default arguments
%feature("compactdefaultargs") find_error; %feature("compactdefaultargs") find_error;
%feature("compactdefaultargs") find_notype; %feature("compactdefaultargs") find_notype;
%feature("compactdefaultargs") find_void; %feature("compactdefaultargs") find_void;
%feature("compactdefaultargs") find_imm; %feature("compactdefaultargs") find_imm;
// FIXME: search() should be checked and enabled // FIXME: search() should be checked and enabled
%ignore search; %ignore search;
%ignore user2bin; %ignore user2bin;
%include "search.hpp" %include "search.hpp"
%clear int *opnum; %clear int *opnum;

View File

@ -1,33 +1,33 @@
// Ignore functions with callbacks // Ignore functions with callbacks
%ignore enumerate_selectors; %ignore enumerate_selectors;
%ignore enumerate_segments_with_selector; %ignore enumerate_segments_with_selector;
// Kernel-only // Kernel-only
%ignore init_groups; %ignore init_groups;
%ignore save_groups; %ignore save_groups;
%ignore term_groups; %ignore term_groups;
%ignore vset_segm_name; %ignore vset_segm_name;
%ignore get_segm_expr; %ignore get_segm_expr;
%ignore get_based_segm_expr; %ignore get_based_segm_expr;
%ignore createSegmentation; %ignore createSegmentation;
%ignore initSegment; %ignore initSegment;
%ignore save_segments; %ignore save_segments;
%ignore termSegment; %ignore termSegment;
%ignore DeleteAllSegments; %ignore DeleteAllSegments;
%ignore delete_debug_segments; %ignore delete_debug_segments;
%ignore is_debugger_segm; %ignore is_debugger_segm;
%ignore is_ephemeral_segm; %ignore is_ephemeral_segm;
%ignore correct_address; %ignore correct_address;
%include "segment.hpp" %include "segment.hpp"
%inline %{ %inline %{
sel_t get_defsr(segment_t *s, int reg) sel_t get_defsr(segment_t *s, int reg)
{ {
return s->defsr[reg]; return s->defsr[reg];
} }
void set_defsr(segment_t *s, int reg, sel_t value) void set_defsr(segment_t *s, int reg, sel_t value)
{ {
s->defsr[reg] = value; s->defsr[reg] = value;
} }
%} %}

View File

@ -1,21 +1,21 @@
// Ignore kernel-only symbols // Ignore kernel-only symbols
%ignore createSRarea; %ignore createSRarea;
%ignore killSRareas; %ignore killSRareas;
%ignore delSRarea; %ignore delSRarea;
%ignore SRareaStart; %ignore SRareaStart;
%ignore SRareaEnd; %ignore SRareaEnd;
%ignore repairSRarea; %ignore repairSRarea;
%ignore SRinit; %ignore SRinit;
%ignore SRterm; %ignore SRterm;
%ignore SRsave; %ignore SRsave;
#define R_es 29 #define R_es 29
#define R_cs 30 #define R_cs 30
#define R_ss 31 #define R_ss 31
#define R_ds 32 #define R_ds 32
#define R_fs 33 #define R_fs 33
#define R_gs 34 #define R_gs 34
%feature("compactdefaultargs") splitSRarea1; %feature("compactdefaultargs") splitSRarea1;
%include "srarea.hpp" %include "srarea.hpp"

View File

@ -1,14 +1,14 @@
// Kernel-only symbols // Kernel-only symbols
%ignore init_struc; %ignore init_struc;
%ignore save_struc; %ignore save_struc;
%ignore term_struc; %ignore term_struc;
%feature("compactdefaultargs") add_struc; %feature("compactdefaultargs") add_struc;
%include "struct.hpp" %include "struct.hpp"
// Add a get_member() member function to struc_t. // Add a get_member() member function to struc_t.
// This helps to access the members array in the class. // This helps to access the members array in the class.
%extend struc_t { %extend struc_t {
member_t * get_member(int index) { return &(self->members[index]); } member_t * get_member(int index) { return &(self->members[index]); }
} }

View File

@ -1,90 +1,90 @@
// Convert an incoming Python list to a tid_t[] array // Convert an incoming Python list to a tid_t[] array
%typemap(in) tid_t[ANY](tid_t temp[$1_dim0]) { %typemap(in) tid_t[ANY](tid_t temp[$1_dim0]) {
int i, len; int i, len;
if (!PySequence_Check($input)) if (!PySequence_Check($input))
{ {
PyErr_SetString(PyExc_TypeError,"Expecting a sequence"); PyErr_SetString(PyExc_TypeError,"Expecting a sequence");
return NULL; return NULL;
} }
/* Cap the number of elements to copy */ /* Cap the number of elements to copy */
len = PySequence_Length($input) < $1_dim0 ? PySequence_Length($input) : $1_dim0; len = PySequence_Length($input) < $1_dim0 ? PySequence_Length($input) : $1_dim0;
for (i =0; i < len; i++) for (i =0; i < len; i++)
{ {
PyObject *o = PySequence_GetItem($input,i); PyObject *o = PySequence_GetItem($input,i);
if (!PyLong_Check(o)) if (!PyLong_Check(o))
{ {
Py_XDECREF(o); Py_XDECREF(o);
PyErr_SetString(PyExc_ValueError,"Expecting a sequence of long integers"); PyErr_SetString(PyExc_ValueError,"Expecting a sequence of long integers");
return NULL; return NULL;
} }
temp[i] = PyLong_AsUnsignedLong(o); temp[i] = PyLong_AsUnsignedLong(o);
Py_DECREF(o); Py_DECREF(o);
} }
$1 = &temp[0]; $1 = &temp[0];
} }
%define %cstring_output_maxstr_none(TYPEMAP, SIZE) %define %cstring_output_maxstr_none(TYPEMAP, SIZE)
%typemap (default) SIZE { %typemap (default) SIZE {
$1 = MAXSTR; $1 = MAXSTR;
} }
%typemap(in,numinputs=0) (TYPEMAP, SIZE) { %typemap(in,numinputs=0) (TYPEMAP, SIZE) {
#ifdef __cplusplus #ifdef __cplusplus
$1 = ($1_ltype) new char[MAXSTR+1]; $1 = ($1_ltype) new char[MAXSTR+1];
#else #else
$1 = ($1_ltype) malloc(MAXSTR+1); $1 = ($1_ltype) malloc(MAXSTR+1);
#endif #endif
} }
%typemap(out) ssize_t { %typemap(out) ssize_t {
/* REMOVING ssize_t return value in $symname */ /* REMOVING ssize_t return value in $symname */
} }
%typemap(argout) (TYPEMAP,SIZE) { %typemap(argout) (TYPEMAP,SIZE) {
if (result > 0) if (result > 0)
{ {
resultobj = PyString_FromString($1); resultobj = PyString_FromString($1);
} }
else else
{ {
Py_INCREF(Py_None); Py_INCREF(Py_None);
resultobj = Py_None; resultobj = Py_None;
} }
#ifdef __cplusplus #ifdef __cplusplus
delete [] $1; delete [] $1;
#else #else
free($1); free($1);
#endif #endif
} }
%enddef %enddef
%define %cstring_bounded_output_none(TYPEMAP,MAX) %define %cstring_bounded_output_none(TYPEMAP,MAX)
%typemap(in, numinputs=0) TYPEMAP(char temp[MAX+1]) { %typemap(in, numinputs=0) TYPEMAP(char temp[MAX+1]) {
$1 = ($1_ltype) temp; $1 = ($1_ltype) temp;
} }
%typemap(argout,fragment="t_output_helper") TYPEMAP { %typemap(argout,fragment="t_output_helper") TYPEMAP {
PyObject *o; PyObject *o;
$1[MAX] = 0; $1[MAX] = 0;
if ($1 > 0) if ($1 > 0)
{ {
o = PyString_FromString($1); o = PyString_FromString($1);
} }
else else
{ {
o = Py_None; o = Py_None;
Py_INCREF(Py_None); Py_INCREF(Py_None);
} }
$result = t_output_helper($result,o); $result = t_output_helper($result,o);
} }
%enddef %enddef
// Check that the argument is a callable Python object // Check that the argument is a callable Python object
%typemap(in) PyObject *pyfunc { %typemap(in) PyObject *pyfunc {
if (!PyCallable_Check($input)) { if (!PyCallable_Check($input)) {
PyErr_SetString(PyExc_TypeError, "Expecting a callable object"); PyErr_SetString(PyExc_TypeError, "Expecting a callable object");
return NULL; return NULL;
} }
$1 = $input; $1 = $input;
} }

View File

@ -1,22 +1,22 @@
// Ignore kernel-only functions and variables // Ignore kernel-only functions and variables
%ignore create_xrefs_from; %ignore create_xrefs_from;
%ignore create_xrefs_from_data; %ignore create_xrefs_from_data;
%ignore delete_all_xrefs_from; %ignore delete_all_xrefs_from;
%ignore delete_data_xrefs_from; %ignore delete_data_xrefs_from;
%ignore delete_code_xrefs_from; %ignore delete_code_xrefs_from;
%ignore destroy_if_align; %ignore destroy_if_align;
%ignore lastXR; %ignore lastXR;
%ignore has_jump_or_flow_xref; %ignore has_jump_or_flow_xref;
%ignore has_call_xref; %ignore has_call_xref;
%ignore destroy_switch_info; %ignore destroy_switch_info;
// These functions should not be called directly (according to docs) // These functions should not be called directly (according to docs)
%ignore xrefblk_t_first_from; %ignore xrefblk_t_first_from;
%ignore xrefblk_t_next_from; %ignore xrefblk_t_next_from;
%ignore xrefblk_t_first_to; %ignore xrefblk_t_first_to;
%ignore xrefblk_t_next_to; %ignore xrefblk_t_next_to;
// 'from' is a reserved Python keyword // 'from' is a reserved Python keyword
%rename (frm) from; %rename (frm) from;
%include "xref.hpp" %include "xref.hpp"

View File

@ -1,25 +1,25 @@
#------------------------------------------------------------ #------------------------------------------------------------
# gendoc.py: Generate an API cross-reference for IDAPython # gendoc.py: Generate an API cross-reference for IDAPython
#------------------------------------------------------------ #------------------------------------------------------------
__author__ = "Gergely Erdelyi <dyce@d-dome.net>" __author__ = "Gergely Erdelyi <dyce@d-dome.net>"
import epydoc.cli import epydoc.cli
# This is a small hack to prevent epydoc from exiting the whole # This is a small hack to prevent epydoc from exiting the whole
# IDA process in case something goes wrong. # IDA process in case something goes wrong.
def exit(eval): def exit(eval):
print "not exiting" print "not exiting"
epydoc.cli.sys.exit = exit epydoc.cli.sys.exit = exit
# Fill in the command-line arguments # Fill in the command-line arguments
epydoc.cli.optparse.sys.argv = [ 'epydoc', epydoc.cli.optparse.sys.argv = [ 'epydoc',
'--no-sourcecode', '--no-sourcecode',
'-u', 'http://www.d-dome.net/idapython/', '-u', 'http://www.d-dome.net/idapython/',
'--navlink', '<a href="http://www.d-dome.net/idapython/reference/">IDAPython Reference</a>', '--navlink', '<a href="http://www.d-dome.net/idapython/reference/">IDAPython Reference</a>',
'--no-private', '--no-private',
'--simple-term', '--simple-term',
'-o', 'idapython-reference-%d.%d.%d' % (IDAPYTHON_VERSION[:3]), '-o', 'idapython-reference-%d.%d.%d' % (IDAPYTHON_VERSION[:3]),
'--html', '--html',
'idc', 'idautils', 'idaapi' ] 'idc', 'idautils', 'idaapi' ]
# Generate the documentation # Generate the documentation
epydoc.cli.cli() epydoc.cli.cli()