mirror of
https://github.com/cemu-project/idapython.git
synced 2024-12-25 17:21:53 +01:00
idc.py: Added OpFloat()
idc.py: Stricter type check in SetRegValue(). Thanks to Igor Skochinsky for the patches.
This commit is contained in:
parent
d26536abd4
commit
b21e3b5230
@ -444,8 +444,8 @@ def Eval(expr):
|
||||
|
||||
|
||||
def EVAL_FAILURE(code):
|
||||
"""
|
||||
Check the result of Eval() for evaluation failures
|
||||
"""
|
||||
Check the result of Eval() for evaluation failures
|
||||
|
||||
@param code: result of Eval()
|
||||
|
||||
@ -1150,6 +1150,19 @@ def OpNumber(ea, n):
|
||||
return idaapi.op_num(ea, n)
|
||||
|
||||
|
||||
def OpFloat(ea, n):
|
||||
"""
|
||||
Convert operand to a floating-point number
|
||||
|
||||
@param ea: linear address
|
||||
@param n: number of operand
|
||||
- 0 - the first operand
|
||||
- 1 - the second, third and all other operands
|
||||
- -1 - all operands
|
||||
"""
|
||||
return idaapi.op_flt(ea, n)
|
||||
|
||||
|
||||
def OpAlt(ea, n, opstr):
|
||||
"""
|
||||
Specify operand represenation manually.
|
||||
@ -6892,6 +6905,16 @@ def SetRegValue(value, name):
|
||||
A register name in the left side of an assignment will do too.
|
||||
"""
|
||||
rv = idaapi.regval_t()
|
||||
if type(value)==types.StringType:
|
||||
value = int(value)
|
||||
elif type(value)!=types.IntType:
|
||||
print "SetRegValue: value must be integer!"
|
||||
return BADADDR
|
||||
|
||||
if value<0:
|
||||
#ival_set cannot handle negative numbers
|
||||
value &= 0xFFFFFFFF
|
||||
|
||||
rv.ival = value
|
||||
return idaapi.set_reg_val(name, rv)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user