From e9f1e0451905f3ecbe8d2e390c1660a20d5d2828 Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Tue, 27 Jan 2009 17:37:10 +0000 Subject: [PATCH] idautils.py: CPU registers are now accessible as cpu.EAX (bot read and write). Patch by Igor Skochinsky --- python/idautils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/python/idautils.py b/python/idautils.py index 9ad7721..a7ffd56 100644 --- a/python/idautils.py +++ b/python/idautils.py @@ -343,3 +343,16 @@ def GetInputFileMD5(): @return: MD5 string or None on error """ return idc.GetInputMD5() + + +class _cpu: + "Simple wrapper around GetRegValue/SetRegValue" + def __getattr__(self, name): + #print "cpu.get(%s)"%name + return idc.GetRegValue(name) + + def __setattr__(self, name, value): + #print "cpu.set(%s)"%name + return idc.SetRegValue(value, name) + +cpu = _cpu()