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")
|
"Return process by index")
|
||||||
.def("getProcessById", TargetSystemAdapter::getProcessById,
|
.def("getProcessById", TargetSystemAdapter::getProcessById,
|
||||||
"Return process by id")
|
"Return process by id")
|
||||||
|
.def("getProcessBySystemId", TargetSystemAdapter::getProcessBySystemId,
|
||||||
|
"Return process by PID")
|
||||||
.def("currentProcess", TargetSystemAdapter::getCurrentProcess,
|
.def("currentProcess", TargetSystemAdapter::getCurrentProcess,
|
||||||
"Return current process")
|
"Return current process")
|
||||||
.def("processes", TargetSystemAdapter::getProcessesList,
|
.def("processes", TargetSystemAdapter::getProcessesList,
|
||||||
@ -607,6 +609,8 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
"Return thread by its index" )
|
"Return thread by its index" )
|
||||||
.def("getThreadById", TargetProcessAdapter::getThreadById,
|
.def("getThreadById", TargetProcessAdapter::getThreadById,
|
||||||
"Return thread by its index")
|
"Return thread by its index")
|
||||||
|
.def("getThreadBySystemId", TargetProcessAdapter::getThreadBySystemId,
|
||||||
|
"Return thread by tid")
|
||||||
.def("currentThread", TargetProcessAdapter::getCurrentThread,
|
.def("currentThread", TargetProcessAdapter::getCurrentThread,
|
||||||
"Return current thread" )
|
"Return current thread" )
|
||||||
.def("getNumberBreakpoints", TargetProcessAdapter::getNumberBreakpoints,
|
.def("getNumberBreakpoints", TargetProcessAdapter::getNumberBreakpoints,
|
||||||
|
@ -81,6 +81,12 @@ struct TargetSystemAdapter {
|
|||||||
return system.getProcessById(id);
|
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)
|
static kdlib::TargetProcessPtr getCurrentProcess(kdlib::TargetSystem& system)
|
||||||
{
|
{
|
||||||
AutoRestorePyState pystate;
|
AutoRestorePyState pystate;
|
||||||
@ -167,6 +173,12 @@ struct TargetProcessAdapter {
|
|||||||
return process.getThreadById(id);
|
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)
|
static kdlib::TargetThreadPtr getCurrentThread(kdlib::TargetProcess& process)
|
||||||
{
|
{
|
||||||
AutoRestorePyState pystate;
|
AutoRestorePyState pystate;
|
||||||
|
@ -4,9 +4,9 @@ import re
|
|||||||
|
|
||||||
from pykd import *
|
from pykd import *
|
||||||
|
|
||||||
fwpsLayer = typeInfo( "FWPS_BUILTIN_LAYERS_" ).asMap()
|
fwpsLayer = dict( [ (long(val), key) for key, val in typeInfo( "FWPS_BUILTIN_LAYERS_" ).fields() ] )
|
||||||
fwpsDataType = typeInfo( "FWP_DATA_TYPE_" ).asMap()
|
fwpsDataType = dict( [ (long(val), key) for key, val in typeInfo( "FWP_DATA_TYPE_" ).fields() ] )
|
||||||
fwpDirection = typeInfo( "FWP_DIRECTION_" ).asMap()
|
fwpDirection = dict( [ (long(val), key) for key, val in typeInfo( "FWP_DIRECTION_" ).fields() ] )
|
||||||
|
|
||||||
def printBlob( blob ):
|
def printBlob( blob ):
|
||||||
bb = loadBytes( blob.data, blob.size )
|
bb = loadBytes( blob.data, blob.size )
|
||||||
@ -47,7 +47,7 @@ def wfpFixedValues( addr ):
|
|||||||
dprintln( "FWPS_INCOMING_VALUES0:" )
|
dprintln( "FWPS_INCOMING_VALUES0:" )
|
||||||
|
|
||||||
inFixedValue = typedVar( "FWPS_INCOMING_VALUES0_", addr )
|
inFixedValue = typedVar( "FWPS_INCOMING_VALUES0_", addr )
|
||||||
|
|
||||||
dprintln( " Layer: " + fwpsLayer[ inFixedValue.layerId ] )
|
dprintln( " Layer: " + fwpsLayer[ inFixedValue.layerId ] )
|
||||||
dprintln( " Value: %d" % inFixedValue.valueCount )
|
dprintln( " Value: %d" % inFixedValue.valueCount )
|
||||||
|
|
||||||
@ -59,10 +59,10 @@ def wfpFixedValues( addr ):
|
|||||||
layerName = discardRe.sub( '', layerName, 1 )
|
layerName = discardRe.sub( '', layerName, 1 )
|
||||||
|
|
||||||
layerRe = re.compile( 'LAYER' )
|
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) ):
|
for i in xrange( min(len(fwpsFields),len(values)) ):
|
||||||
dprintln( " " + fwpsFields[ i ] )
|
dprintln( " " + fwpsFields[i][0] )
|
||||||
dprintln( " Type: " + fwpsDataType[ values[i].field("type") ] )
|
dprintln( " Type: " + fwpsDataType[ values[i].field("type") ] )
|
||||||
dprintln( " Value: " + printFwpsValue( values[i] ) )
|
dprintln( " Value: " + printFwpsValue( values[i] ) )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user