mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-19 02:53:22 +08:00
[0.3.x] added : targetSystem.getProcessBySystemId method ( return process by PID )
[0.3.x] added : targetProcess.getThreadBySystemId method ( return thread by tid ) git-svn-id: https://pykd.svn.codeplex.com/svn@91010 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
5be20080a3
commit
0d0648873b
@ -575,6 +575,8 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Return process by index")
|
||||
.def("getProcessById", TargetSystemAdapter::getProcessById,
|
||||
"Return process by id")
|
||||
.def("getProcessBySystemId", TargetSystemAdapter::getProcessBySystemId,
|
||||
"Return process by PID")
|
||||
.def("currentProcess", TargetSystemAdapter::getCurrentProcess,
|
||||
"Return current process")
|
||||
.def("processes", TargetSystemAdapter::getProcessesList,
|
||||
@ -607,6 +609,8 @@ BOOST_PYTHON_MODULE( pykd )
|
||||
"Return thread by its index" )
|
||||
.def("getThreadById", TargetProcessAdapter::getThreadById,
|
||||
"Return thread by its index")
|
||||
.def("getThreadBySystemId", TargetProcessAdapter::getThreadBySystemId,
|
||||
"Return thread by tid")
|
||||
.def("currentThread", TargetProcessAdapter::getCurrentThread,
|
||||
"Return current thread" )
|
||||
.def("getNumberBreakpoints", TargetProcessAdapter::getNumberBreakpoints,
|
||||
|
@ -81,6 +81,12 @@ struct TargetSystemAdapter {
|
||||
return system.getProcessById(id);
|
||||
}
|
||||
|
||||
static kdlib::TargetProcessPtr getProcessBySystemId(kdlib::TargetSystem& system, kdlib::PROCESS_ID pid)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return system.getProcessBySystemId(pid);
|
||||
}
|
||||
|
||||
static kdlib::TargetProcessPtr getCurrentProcess(kdlib::TargetSystem& system)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
@ -167,6 +173,12 @@ struct TargetProcessAdapter {
|
||||
return process.getThreadById(id);
|
||||
}
|
||||
|
||||
static kdlib::TargetThreadPtr getThreadBySystemId(kdlib::TargetProcess& process, kdlib::THREAD_ID tid)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
return process.getThreadBySystemId(tid);
|
||||
}
|
||||
|
||||
static kdlib::TargetThreadPtr getCurrentThread(kdlib::TargetProcess& process)
|
||||
{
|
||||
AutoRestorePyState pystate;
|
||||
|
@ -4,9 +4,9 @@ import re
|
||||
|
||||
from pykd import *
|
||||
|
||||
fwpsLayer = typeInfo( "FWPS_BUILTIN_LAYERS_" ).asMap()
|
||||
fwpsDataType = typeInfo( "FWP_DATA_TYPE_" ).asMap()
|
||||
fwpDirection = typeInfo( "FWP_DIRECTION_" ).asMap()
|
||||
fwpsLayer = dict( [ (long(val), key) for key, val in typeInfo( "FWPS_BUILTIN_LAYERS_" ).fields() ] )
|
||||
fwpsDataType = dict( [ (long(val), key) for key, val in typeInfo( "FWP_DATA_TYPE_" ).fields() ] )
|
||||
fwpDirection = dict( [ (long(val), key) for key, val in typeInfo( "FWP_DIRECTION_" ).fields() ] )
|
||||
|
||||
def printBlob( blob ):
|
||||
bb = loadBytes( blob.data, blob.size )
|
||||
@ -47,7 +47,7 @@ def wfpFixedValues( addr ):
|
||||
dprintln( "FWPS_INCOMING_VALUES0:" )
|
||||
|
||||
inFixedValue = typedVar( "FWPS_INCOMING_VALUES0_", addr )
|
||||
|
||||
|
||||
dprintln( " Layer: " + fwpsLayer[ inFixedValue.layerId ] )
|
||||
dprintln( " Value: %d" % inFixedValue.valueCount )
|
||||
|
||||
@ -59,10 +59,10 @@ def wfpFixedValues( addr ):
|
||||
layerName = discardRe.sub( '', layerName, 1 )
|
||||
|
||||
layerRe = re.compile( 'LAYER' )
|
||||
fwpsFields = typeInfo( layerRe.sub( 'FIELDS', layerName, 1 ) + '_' ).asMap()
|
||||
fwpsFields = typeInfo( layerRe.sub( 'FIELDS', layerName, 1 ) + '_' ).fields()
|
||||
|
||||
for i in range( 0, len(values) ):
|
||||
dprintln( " " + fwpsFields[ i ] )
|
||||
for i in xrange( min(len(fwpsFields),len(values)) ):
|
||||
dprintln( " " + fwpsFields[i][0] )
|
||||
dprintln( " Type: " + fwpsDataType[ values[i].field("type") ] )
|
||||
dprintln( " Value: " + printFwpsValue( values[i] ) )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user