pykd/samples/um/critlist.py
SND\kernelnet_cp ed0831362b [0.2.x] fixed : multiple bug with WOW64 debugging
git-svn-id: https://pykd.svn.codeplex.com/svn@81305 9b283d60-5439-405e-af05-b73fd8c4d996
2017-11-08 17:42:50 +04:00

34 lines
849 B
Python

from pykd import *
def main():
pass
def listCritSections():
ntdll = module("ntdll")
dbglst = ntdll.typedVarList( ntdll.RtlCriticalSectionList, "_RTL_CRITICAL_SECTION_DEBUG", "ProcessLocksList" )
crtlst = [ ntdll.typedVar( "_RTL_CRITICAL_SECTION", x.CriticalSection ) for x in dbglst ]
for crtsec in crtlst:
dprintln("")
dprintln( "CRITICAL SECTION address = %#x ( %s ) " % ( crtsec, findSymbol( crtsec ) ) )
dprintln( " Owning thread = %x" % crtsec.OwningThread )
dprintln( " Lock count = %d" % crtsec.LockCount )
def run():
while True:
if isKernelDebugging():
dprintln( "not a user debugging" )
break
listCritSections()
break
if __name__ == "__main__":
run()