From 381b06610beb50ba30a586e0b159be7de7d7fe1b Mon Sep 17 00:00:00 2001
From: "SND\\ussrhero_cp"
 <SND\ussrhero_cp@9b283d60-5439-405e-af05-b73fd8c4d996>
Date: Sun, 8 Jan 2017 10:06:13 +0000
Subject: [PATCH] [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
---
 pykd/pymod.cpp           | 2 ++
 pykd/pymodule.h          | 6 ++++++
 test/scripts/typedvar.py | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp
index 712541a..ef19d06 100644
--- a/pykd/pymod.cpp
+++ b/pykd/pymod.cpp
@@ -795,6 +795,8 @@ BOOST_PYTHON_MODULE( pykd )
 			"Return a typedVar class instance")
 		.def("typedVar", ModuleAdapter::getTypedVarByTypeName,
 			"Return a typedVar class instance")
+		.def("typedVar", ModuleAdapter::getTypedVarWithPrototype,
+			"Return a typedVar class instance")
 		.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")
 		.def("typedVarArray", ModuleAdapter::getTypedVarArrayByTypeName,
diff --git a/pykd/pymodule.h b/pykd/pymodule.h
index ab5bc61..5c938d6 100644
--- a/pykd/pymodule.h
+++ b/pykd/pymodule.h
@@ -131,6 +131,12 @@ struct ModuleAdapter : public kdlib::Module
         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 )
     {
         AutoRestorePyState  pystate;
diff --git a/test/scripts/typedvar.py b/test/scripts/typedvar.py
index c7bb187..3373295 100644
--- a/test/scripts/typedvar.py
+++ b/test/scripts/typedvar.py
@@ -387,6 +387,8 @@ class TypedVarTest( unittest.TestCase ):
         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 ) )
+        
+        self.assertTrue( target.module.typedVar("OverloadedFunc", "Bool(__cdecl)(Int4B,Int4B)").call(100,299) )
 
     def testCallFunctionWithTypedVar(self):
         funcptr = target.module.typedVar("StdcallFuncRet");