diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp index 2ee7b85..463786d 100644 --- a/pykd/pymod.cpp +++ b/pykd/pymod.cpp @@ -919,12 +919,14 @@ BOOST_PYTHON_MODULE( pykd ) "Cast variable to the type and return new typedVar instance") .def("castTo", TypedVarAdapter::castByTypeInfo, "Cast variable to the type and return new typedVar instance") + .def("call", python::raw_function(pykd::callFunctionByVar, 0) ) .def("__getattr__", TypedVarAdapter::getFieldAttr, "Return field of structure as an object attribute" ) .def( "__str__", TypedVarAdapter::print ) .def("__len__", TypedVarAdapter::getElementCount ) .def("__getitem__", TypedVarAdapter::getElementByIndex ) .def("__dir__", TypedVarAdapter::getElementsDir) + .def("__call__", python::raw_function(pykd::callFunctionByVar, 0) ) //.def("__getitem__", &kdlib::TypedVar::getElementByIndexPtr ) #if PY_VERSION_HEX >= 0x03000000 .def("__bool__", TypedVarAdapter::isNotZero) diff --git a/test/scripts/typedvar.py b/test/scripts/typedvar.py index 0406454..e0ccc8d 100644 --- a/test/scripts/typedvar.py +++ b/test/scripts/typedvar.py @@ -380,8 +380,12 @@ class TypedVarTest( unittest.TestCase ): funcptr = target.module.typedVar("CdeclFuncLong"); self.assertEqual( 0xffffff000000 + 5, pykd.callFunctionByPtr( funcptr, target.module.typedVar("ulonglongConst") ) ) + self.assertEqual( 0x7777 + 5, funcptr.call(0x7777) ) + self.assertEqual( 0x11223344556677 + 5, funcptr(0x11223344556677) ); functype = pykd.defineFunction( pykd.baseTypes.Int4B, pykd.callingConvention.NearStd) functype.append("arg1", pykd.baseTypes.Int1B) functype.append("arg2", pykd.baseTypes.Long) self.assertEqual( 500 / 25, pykd.callFunctionByAddr(functype, target.module.offset("StdcallFuncRet"), 25, 500 ) ) + +