From 03156080294df96a00814fea917d4e163ae9adb2 Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Sun, 15 Jun 2008 16:53:55 +0000 Subject: [PATCH] idc.py: Fixed GetOperandValue() --- python/idc.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/python/idc.py b/python/idc.py index 8b2b5e8..26c6b78 100644 --- a/python/idc.py +++ b/python/idc.py @@ -1957,21 +1957,28 @@ def GetOperandValue(ea, n): otherwise => -1 """ inslen = idaapi.ua_code(ea) - if inslen == 0: return -1 insn = idaapi.get_current_instruction() - if not insn: return -1 op = idaapi.get_instruction_operand(insn, n) - if not op: return -1 - return op.value + if op.type in [ idaapi.o_mem, idaapi.o_far, idaapi.o_near, idaapi.o_displ ]: + value = op.addr + elif op.type == idaapi.o_reg: + value = op.reg + elif op.type == idaapi.o_imm: + value = op.value + elif op.type == idaapi.o_phrase: + value = op.phrase + else: + value = -1 + return value def LineA(ea, num):