mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-19 02:53:22 +08:00
[0.3.x] added : typedVar.__call__ method ( run function in the target process )
git-svn-id: https://pykd.svn.codeplex.com/svn@91042 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
efdd835f4d
commit
c4a08ee6b0
@ -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)
|
||||
|
@ -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 ) )
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user