[0.3.x] added : module.typedVar method with prototype argument

git-svn-id: https://pykd.svn.codeplex.com/svn@91108 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\ussrhero_cp 2017-01-08 10:06:13 +00:00 committed by Mikhail I. Izmestev
parent 683241ce2f
commit 381b06610b
3 changed files with 10 additions and 0 deletions

View File

@ -795,6 +795,8 @@ BOOST_PYTHON_MODULE( pykd )
"Return a typedVar class instance") "Return a typedVar class instance")
.def("typedVar", ModuleAdapter::getTypedVarByTypeName, .def("typedVar", ModuleAdapter::getTypedVarByTypeName,
"Return a typedVar class instance") "Return a typedVar class instance")
.def("typedVar", ModuleAdapter::getTypedVarWithPrototype,
"Return a typedVar class instance")
.def("typedVarList", ModuleAdapter::getTypedVarListByTypeName, .def("typedVarList", ModuleAdapter::getTypedVarListByTypeName,
"Return a list of the typedVar class instances. Each item represents an item of the linked list in the target memory") "Return a list of the typedVar class instances. Each item represents an item of the linked list in the target memory")
.def("typedVarArray", ModuleAdapter::getTypedVarArrayByTypeName, .def("typedVarArray", ModuleAdapter::getTypedVarArrayByTypeName,

View File

@ -131,6 +131,12 @@ struct ModuleAdapter : public kdlib::Module
return module.getTypedVarByTypeName(typeName, offset); return module.getTypedVarByTypeName(typeName, offset);
} }
static kdlib::TypedVarPtr getTypedVarWithPrototype(kdlib::Module& module, const std::wstring &symbolName, const std::wstring &prototype)
{
AutoRestorePyState pystate;
return module.getTypedVarWithPrototype(symbolName, prototype);
}
static kdlib::TypedVarPtr containingRecord(kdlib::Module& module, kdlib::MEMOFFSET_64 offset, const std::wstring &typeName, const std::wstring &fieldName ) static kdlib::TypedVarPtr containingRecord(kdlib::Module& module, kdlib::MEMOFFSET_64 offset, const std::wstring &typeName, const std::wstring &fieldName )
{ {
AutoRestorePyState pystate; AutoRestorePyState pystate;

View File

@ -388,6 +388,8 @@ class TypedVarTest( unittest.TestCase ):
functype.append("arg2", pykd.baseTypes.Long) functype.append("arg2", pykd.baseTypes.Long)
self.assertEqual( 500 / 25, pykd.callFunctionByAddr(functype, target.module.offset("StdcallFuncRet"), 25, 500 ) ) self.assertEqual( 500 / 25, pykd.callFunctionByAddr(functype, target.module.offset("StdcallFuncRet"), 25, 500 ) )
self.assertTrue( target.module.typedVar("OverloadedFunc", "Bool(__cdecl)(Int4B,Int4B)").call(100,299) )
def testCallFunctionWithTypedVar(self): def testCallFunctionWithTypedVar(self):
funcptr = target.module.typedVar("StdcallFuncRet"); funcptr = target.module.typedVar("StdcallFuncRet");
ucharVar = target.module.typedVar( "ucharVar" ); ucharVar = target.module.typedVar( "ucharVar" );