Skip to content
This repository was archived by the owner on Nov 19, 2018. It is now read-only.

Commit a0e041c

Browse files
committed
- applied patchs for IDA 6.4 SP from Hex-Rays
- fixed idc.CommentEx() - minor mods
1 parent a0ea5fd commit a0e041c

8 files changed

Lines changed: 60 additions & 198 deletions

File tree

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Please see http://code.google.com/p/idapython/source/list for a detailed list of changes.
22

3+
Changes from version 1.5.5 to 1.5.6
4+
------------------------------------
5+
- IDA Pro 6.4 support
6+
37
Changes from version 1.5.4 to 1.5.5
48
------------------------------------
59
- IDA Pro 6.3 support

build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
VERBOSE = True
2525

2626
IDA_MAJOR_VERSION = 6
27-
IDA_MINOR_VERSION = 3
27+
IDA_MINOR_VERSION = 4
2828

2929
if 'IDA' in os.environ:
3030
IDA_SDK = os.environ['IDA']
@@ -36,7 +36,7 @@
3636
# IDAPython version
3737
VERSION_MAJOR = 1
3838
VERSION_MINOR = 5
39-
VERSION_PATCH = 5
39+
VERSION_PATCH = 6
4040

4141
# Determine Python version
4242
PYTHON_MAJOR_VERSION = int(platform.python_version()[0])
@@ -516,4 +516,4 @@ def main():
516516
build_source_package()
517517

518518
if __name__ == "__main__":
519-
main()
519+
main()

python.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -427,25 +427,25 @@ static int PyRunFile(const char *FileName)
427427
}
428428
#endif
429429

430-
PyObject *PyFileObject = PyFile_FromString((char*)FileName, "r");
430+
PyObject *file_obj = PyFile_FromString((char*)FileName, "r"); //lint !e1776
431431
PyObject *globals = GetMainGlobals();
432-
if ( globals == NULL || PyFileObject == NULL )
432+
if ( globals == NULL || file_obj == NULL )
433433
{
434-
Py_XDECREF(PyFileObject);
434+
Py_XDECREF(file_obj);
435435
return 0;
436436
}
437437
PyErr_Clear();
438438

439439
PYW_GIL_ENSURE;
440440
PyObject *result = PyRun_File(
441-
PyFile_AsFile(PyFileObject),
441+
PyFile_AsFile(file_obj),
442442
FileName,
443443
Py_file_input,
444444
globals,
445445
globals);
446446
PYW_GIL_RELEASE;
447447

448-
Py_XDECREF(PyFileObject);
448+
Py_XDECREF(file_obj);
449449
Py_XDECREF(result);
450450

451451
return result != NULL && !PyErr_Occurred();

python/idc.py

Lines changed: 16 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,6 @@ def MakeArray(ea, nitems):
670670
"""
671671
flags = idaapi.getFlags(ea)
672672

673-
if idaapi.isCode(flags) or idaapi.isTail(flags) or idaapi.isAlign(flags):
674-
return False
675-
676673
if idaapi.isCode(flags) or idaapi.isTail(flags) or idaapi.isAlign(flags):
677674
return False
678675

@@ -790,17 +787,6 @@ def MakeYword(ea):
790787
return idaapi.doYwrd(ea, 32)
791788

792789

793-
def MakeYword(ea):
794-
"""
795-
Convert the current item to a ymm word (32 bytes/256 bits)
796-
797-
@param ea: linear address
798-
799-
@return: 1-ok, 0-failure
800-
"""
801-
return idaapi.doYwrd(ea, 32)
802-
803-
804790
def MakeFloat(ea):
805791
"""
806792
Convert the current item to a floating point (4 bytes)
@@ -2358,12 +2344,24 @@ def GetCommentEx(ea, repeatable):
23582344
23592345
@param ea: linear address
23602346
2347+
@param repeatable: 1 to get the repeatable comment, 0 to get the normal comment
2348+
23612349
@return: string or None if it fails
23622350
"""
23632351
return idaapi.get_cmt(ea, repeatable)
23642352

23652353

2366-
def CommentEx(ea, repeatable): GetCommentEx(ea, repeatable)
2354+
def CommentEx(ea, repeatable):
2355+
"""
2356+
Get regular indented comment
2357+
2358+
@param ea: linear address
2359+
2360+
@param repeatable: 1 to get the repeatable comment, 0 to get the normal comment
2361+
2362+
@return: string or None if it fails
2363+
"""
2364+
return GetCommentEx(ea, repeatable)
23672365

23682366

23692367
def AltOp(ea, n):
@@ -6983,159 +6981,6 @@ def DelHiddenArea(ea):
69836981
return idaapi.del_hidden_area(ea)
69846982

69856983

6986-
6987-
def GetStepTraceOptions():
6988-
"""
6989-
Get step current tracing options
6990-
6991-
@return: a combination of ST_... constants
6992-
"""
6993-
return idaapi.get_step_trace_options()
6994-
6995-
6996-
def SetStepTraceOptions(options):
6997-
"""
6998-
Set step current tracing options.
6999-
@param options: combination of ST_... constants
7000-
"""
7001-
return idaapi.set_step_trace_options(options)
7002-
7003-
7004-
ST_OVER_DEBUG_SEG = 0x01 # step tracing will be disabled when IP is in a debugger segment
7005-
ST_OVER_LIB_FUNC = 0x02 # step tracing will be disabled when IP is in a library function
7006-
ST_ALREADY_LOGGED = 0x04 # step tracing will be disabled when IP is already logged
7007-
ST_SKIP_LOOPS = 0x08 # step tracing will try to skip loops already recorded
7008-
7009-
def LoadTraceFile(filename):
7010-
"""
7011-
Load a previously recorded binary trace file
7012-
@param filename: trace file
7013-
"""
7014-
return idaapi.load_trace_file(filename, None)
7015-
7016-
def SaveTraceFile(filename, description):
7017-
"""
7018-
Save current trace to a binary trace file
7019-
@param filename: trace file
7020-
"""
7021-
return idaapi.save_trace_file(filename, description)
7022-
7023-
def CheckTraceFile(filename):
7024-
"""
7025-
Check the given binary trace file
7026-
@param filename: trace file
7027-
"""
7028-
return idaapi.is_valid_trace_file(filename)
7029-
7030-
def ClearTraceFile(filename):
7031-
"""
7032-
Clear the current trace buffer
7033-
"""
7034-
return idaapi.clear_trace()
7035-
7036-
def GetTraceDesc(filename):
7037-
"""
7038-
Get the trace description of the given binary trace file
7039-
@param filename: trace file
7040-
"""
7041-
return idaapi.get_trace_file_desc(filename)
7042-
7043-
def SetTraceDesc(filename, description):
7044-
"""
7045-
Update the trace description of the given binary trace file
7046-
@param filename: trace file
7047-
@description: trace description
7048-
"""
7049-
return idaapi.set_trace_file_desc(filename, description)
7050-
7051-
def GetMaxTev():
7052-
"""
7053-
Return the total number of recorded events
7054-
"""
7055-
return idaapi.get_tev_qty()
7056-
7057-
def GetTevEa(tev):
7058-
"""
7059-
Return the address of the specified event
7060-
@param tev: event number
7061-
"""
7062-
return idaapi.get_tev_ea(tev)
7063-
7064-
TEV_NONE = 0 # no event
7065-
TEV_INSN = 1 # an instruction trace
7066-
TEV_CALL = 2 # a function call trace
7067-
TEV_RET = 3 # a function return trace
7068-
TEV_BPT = 4 # write, read/write, execution trace
7069-
TEV_MEM = 5 # memory layout changed
7070-
TEV_EVENT = 6 # debug event
7071-
7072-
def GetTevType(tev):
7073-
"""
7074-
Return the type of the specified event (TEV_... constants)
7075-
@param tev: event number
7076-
"""
7077-
return idaapi.get_tev_type(tev)
7078-
7079-
def GetTevTid(tev):
7080-
"""
7081-
Return the thread id of the specified event
7082-
@param tev: event number
7083-
"""
7084-
return idaapi.get_tev_tid(tev)
7085-
7086-
def GetTevRegVal(tev, reg):
7087-
"""
7088-
Return the register value for the specified event
7089-
@param tev: event number
7090-
@param reg: register name (like EAX, RBX, ...)
7091-
"""
7092-
return idaapi.get_tev_reg_val(tev, reg)
7093-
7094-
def GetTevRegMemQty(tev):
7095-
"""
7096-
Return the number of memory addresses recorded for the specified event
7097-
@param tev: event number
7098-
"""
7099-
return idaapi.get_tev_reg_mem_qty(tev)
7100-
7101-
def GetTevRegMem(tev, idx):
7102-
"""
7103-
Return the memory pointed by 'index' for the specified event
7104-
@param tev: event number
7105-
@param idx: memory address index
7106-
"""
7107-
return idaapi.get_tev_reg_mem(tev, idx)
7108-
7109-
def GetTevRegMemEa(tev, idx):
7110-
"""
7111-
Return the address pointed by 'index' for the specified event
7112-
@param tev: event number
7113-
@param idx: memory address index
7114-
"""
7115-
return idaapi.get_tev_reg_mem_ea(tev, idx)
7116-
7117-
def GetTevCallee(tev):
7118-
"""
7119-
Return the address of the callee for the specified event
7120-
@param tev: event number
7121-
"""
7122-
return idaapi.get_call_tev_callee(tev)
7123-
7124-
def GetTevReturn(tev):
7125-
"""
7126-
Return the return address for the specified event
7127-
@param tev: event number
7128-
"""
7129-
return idaapi.get_ret_tev_return(tev)
7130-
7131-
def GetBptTevEa(tev):
7132-
"""
7133-
Return the address of the specified TEV_BPT event
7134-
@param tev: event number
7135-
"""
7136-
return idaapi.get_bpt_tev_ea(tev)
7137-
7138-
71396984
#--------------------------------------------------------------------------
71406985
# D E B U G G E R I N T E R F A C E
71416986
#--------------------------------------------------------------------------
@@ -8040,7 +7885,7 @@ def SetBptCndEx(ea, cnd, is_lowcnd):
80407885
return False
80417886

80427887
bpt.condition = cnd
8043-
if not is_lowcnd:
7888+
if is_lowcnd:
80447889
bpt.flags |= BPT_LOWCND
80457890
else:
80467891
bpt.flags &= ~BPT_LOWCND
@@ -8542,9 +8387,10 @@ def SegDefReg(ea, reg, value): return SetSegDefReg(ea, reg, va
85428387

85438388

85448389
def Comment(ea): return GetCommentEx(ea, 0)
8545-
"""Returns the non-repeatable comment or None"""
8390+
"""Returns the regular comment or None"""
85468391

85478392
def RptCmt(ea): return GetCommentEx(ea, 1)
8393+
"""Returns the repeatable comment or None"""
85488394

85498395
def SetReg(ea, reg, value): return SetRegEx(ea, reg, value, SR_user)
85508396

pywraps/py_idaapi.hpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ struct py_timer_ctx_t
9494
};
9595

9696
//------------------------------------------------------------------------
97+
// check if we have a file which is known to be executed automatically
98+
// by SWIG or Python runtime
9799
bool pywraps_check_autoscripts(char *buf, size_t bufsize)
98100
{
99101
static const char *const exts[] =
@@ -114,14 +116,18 @@ bool pywraps_check_autoscripts(char *buf, size_t bufsize)
114116

115117
for ( size_t ifn=0; ifn < qnumber(fns); ++ifn )
116118
{
119+
// check for a script or module with several possible extensions
117120
for ( size_t iext=0; iext < qnumber(exts); ++iext )
118121
{
119122
qsnprintf(buf, bufsize, "%s.%s", fns[ifn], exts[iext]);
120-
if ( qfileexist(fns[ifn]) )
121-
{
122-
qstrncpy(buf, fns[ifn], bufsize);
123+
if ( qfileexist(buf) )
123124
return true;
124-
}
125+
}
126+
// check for a subdirectory under current directory
127+
if ( qfileexist(fns[ifn]) )
128+
{
129+
qstrncpy(buf, fns[ifn], bufsize);
130+
return true;
125131
}
126132
}
127133
return false;

swig/idaapi.i

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,8 @@ struct py_timer_ctx_t
12851285
};
12861286

12871287
//------------------------------------------------------------------------
1288+
// check if we have a file which is known to be executed automatically
1289+
// by SWIG or Python runtime
12881290
bool pywraps_check_autoscripts(char *buf, size_t bufsize)
12891291
{
12901292
static const char *const exts[] =
@@ -1305,14 +1307,18 @@ bool pywraps_check_autoscripts(char *buf, size_t bufsize)
13051307

13061308
for ( size_t ifn=0; ifn < qnumber(fns); ++ifn )
13071309
{
1310+
// check for a script or module with several possible extensions
13081311
for ( size_t iext=0; iext < qnumber(exts); ++iext )
13091312
{
13101313
qsnprintf(buf, bufsize, "%s.%s", fns[ifn], exts[iext]);
1311-
if ( qfileexist(fns[ifn]) )
1312-
{
1313-
qstrncpy(buf, fns[ifn], bufsize);
1314+
if ( qfileexist(buf) )
13141315
return true;
1315-
}
1316+
}
1317+
// check for a subdirectory under current directory
1318+
if ( qfileexist(fns[ifn]) )
1319+
{
1320+
qstrncpy(buf, fns[ifn], bufsize);
1321+
return true;
13161322
}
13171323
}
13181324
return false;

swig/idp.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static PyObject *ph_get_instruc()
360360
{
361361
Py_ssize_t i = 0;
362362
PyObject *py_result = PyTuple_New(ph.instruc_end - ph.instruc_start);
363-
for ( instruc_t *p = ph.instruc + ph.instruc_start, *end = ph.instruc + ph.instruc_end;
363+
for ( const instruc_t *p = ph.instruc + ph.instruc_start, *end = ph.instruc + ph.instruc_end;
364364
p != end;
365365
++p )
366366
{

0 commit comments

Comments
 (0)