diff --git a/pykd/pydbgeng.h b/pykd/pydbgeng.h
index 50ccc1d..f7602ba 100644
--- a/pykd/pydbgeng.h
+++ b/pykd/pydbgeng.h
@@ -298,7 +298,7 @@ std::wstring getExtensionSearchPath()
}
inline
-kdlib::EXTENSION_ID loadExtension(const std::wstring &extPath )
+kdlib::EXTENSION_ID loadExtension( const std::wstring &extPath )
{
AutoRestorePyState pystate;
return kdlib::loadExtension(extPath);
@@ -311,6 +311,13 @@ void removeExtension( kdlib::EXTENSION_ID extId )
kdlib::removeExtension(extId);
}
+inline
+void removeExtension( const std::wstring &extPath )
+{
+ AutoRestorePyState pystate;
+ kdlib::removeExtension(extPath);
+}
+
inline
std::wstring callExtension( kdlib::EXTENSION_ID extId, const std::wstring command, const std::wstring ¶ms )
{
diff --git a/pykd/pymod.cpp b/pykd/pymod.cpp
index d1f321f..b8ba770 100644
--- a/pykd/pymod.cpp
+++ b/pykd/pymod.cpp
@@ -90,7 +90,7 @@ BOOST_PYTHON_MODULE( pykd )
kdlib::dbgerr = &sysPykdErr;
kdlib::dbgin = &sysPykdIn;
- python::scope().attr("version") = pykdVersion;
+ python::scope().attr("__version__") = pykdVersion;
python::def( "initialize", &kdlib::initialize,
"Initialize debug engine, only for console mode" );
@@ -104,8 +104,10 @@ BOOST_PYTHON_MODULE( pykd )
"Return the extension DLL search path" );
python::def( "loadExt", pykd::loadExtension,
"Load a WinDBG extension. Return handle of the loaded extension" );
- python::def( "removeExt", pykd::removeExtension,
- "Unload a WinDBG extension. Parameters: handle returned by loadExt" );
+ python::def( "removeExt", (void(*)(kdlib::EXTENSION_ID))&pykd::removeExtension,
+ "Unload a WinDBG extension. Parameter: handle returned by loadExt" );
+ python::def( "removeExt", (void (*)(const std::wstring& ))&pykd::removeExtension,
+ "Unload a WinDBG extension. Parameter: extension path" );
python::def( "callExt", pykd::callExtension,
"Call a WinDBG extension's routine. Parameters: handle returned by loadExt; string command line" );
diff --git a/snippets/avl.py b/snippets/avl.py
new file mode 100644
index 0000000..5b2efbf
--- /dev/null
+++ b/snippets/avl.py
@@ -0,0 +1,67 @@
+#
+#
+#
+
+import sys
+import re
+
+from pykd import isWindbgExt
+from pykd import dprintln
+from pykd import expr
+from pykd import typedVar
+from pykd import typeInfo
+from pykd import addr64
+from pykd import sizeof
+
+
+def addTableChilds( table, links ):
+
+ table.append( links.getAddress() + sizeof( "nt!_RTL_BALANCED_LINKS" ) )
+
+ if links.LeftChild != 0:
+ addTableChilds( table, typedVar("nt!_RTL_BALANCED_LINKS", links.LeftChild) )
+ if links.RightChild != 0:
+ addTableChilds( table, typedVar("nt!_RTL_BALANCED_LINKS", links.RightChild) )
+
+
+def getAVLTable( addr ):
+
+ table = []
+ avl = typedVar( "nt!_RTL_AVL_TABLE", addr )
+ addTableChilds( table, avl.BalancedRoot )
+ return table
+
+
+def printUsage():
+ dprintln( "!py avl [addr] (type)")
+
+
+if __name__ == "__main__":
+
+ if len( sys.argv ) < 2:
+ printUsage()
+ quit(0)
+
+ showAll = False
+ args = sys.argv
+ if '-a' in args:
+ args.remove('-a')
+ showAll = True
+
+ items = getAVLTable( addr64( expr( sys.argv[1] ) ) )
+
+ if showAll:
+ if len( sys.argv ) == 2:
+ dprintln( "\n".join( [ "db 0x%x" % ( entry, entry ) for entry in items ] ), True )
+ else:
+ ti = typeInfo(sys.argv[2])
+ dprintln( "\n".join( [ "dt %s\n%s" % ( sys.argv[2], entry, sys.argv[2], typedVar(ti, entry) ) for entry in items ] ), True )
+
+ else:
+ if len( sys.argv ) == 2:
+ dprintln( "\n".join( [ "db 0x%x" % ( entry, entry ) for entry in items ] ), True )
+ else:
+ dprintln( "\n".join( [ "dt %s" % ( sys.argv[2], entry, sys.argv[2] ) for entry in items ] ), True )
+
+
+