mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
34 lines
849 B
Python
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()
|