mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[+] routines for loading integer value by pointer ( PtrByte, PtrSignByte, PtrWord ... )
[!] bugfix: typedVar git-svn-id: https://pykd.svn.codeplex.com/svn@53137 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
4547274ef0
commit
ebf8275a94
@ -53,6 +53,15 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
boost::python::def( "loadSignDWords", &loadArray<long> );
|
boost::python::def( "loadSignDWords", &loadArray<long> );
|
||||||
boost::python::def( "loadSignQWords", &loadArray<__int64> );
|
boost::python::def( "loadSignQWords", &loadArray<__int64> );
|
||||||
boost::python::def( "loadPtrs", &loadPtrArray );
|
boost::python::def( "loadPtrs", &loadPtrArray );
|
||||||
|
boost::python::def( "PtrByte", &loadByPtr<unsigned char> );
|
||||||
|
boost::python::def( "PtrSignByte", &loadByPtr<char> );
|
||||||
|
boost::python::def( "PtrWord", &loadByPtr<unsigned short> );
|
||||||
|
boost::python::def( "PtrSignWord", &loadByPtr<short> );
|
||||||
|
boost::python::def( "PtrDWord", &loadByPtr<unsigned long> );
|
||||||
|
boost::python::def( "PtrSignDWord", &loadByPtr<long> );
|
||||||
|
boost::python::def( "PtrQWord", &loadByPtr<unsigned __int64> );
|
||||||
|
boost::python::def( "PtrSignQWord", &loadByPtr<__int64> );
|
||||||
|
boost::python::def( "PtrPtr", &loadPtrByPtr );
|
||||||
boost::python::def( "compareMemory", &compareMemory );
|
boost::python::def( "compareMemory", &compareMemory );
|
||||||
boost::python::class_<typedVarClass>( "typedVarClass" )
|
boost::python::class_<typedVarClass>( "typedVarClass" )
|
||||||
.def("getAddress", &typedVarClass::getAddress );
|
.def("getAddress", &typedVarClass::getAddress );
|
||||||
|
@ -136,3 +136,28 @@ loadPtrArray( ULONG64 address, ULONG number )
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
boost::python::object
|
||||||
|
loadPtrByPtr( ULONG64 address )
|
||||||
|
{
|
||||||
|
if ( is64bitSystem() )
|
||||||
|
{
|
||||||
|
ULONG64 value;
|
||||||
|
|
||||||
|
if ( loadMemory( address, &value, sizeof(ULONG64) ) )
|
||||||
|
return boost::python::object( value );
|
||||||
|
|
||||||
|
return boost::python::object();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ULONG value;
|
||||||
|
|
||||||
|
if ( loadMemory( address, &value, sizeof(ULONG) ) )
|
||||||
|
return boost::python::object( addr64( value ) );
|
||||||
|
|
||||||
|
return boost::python::object();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
@ -32,6 +32,24 @@ loadArray( ULONG64 address, ULONG number )
|
|||||||
return boost::python::object();
|
return boost::python::object();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
boost::python::object
|
||||||
|
loadByPtr( ULONG64 address )
|
||||||
|
{
|
||||||
|
T value;
|
||||||
|
|
||||||
|
if ( loadMemory( address, &value, sizeof(T) ) )
|
||||||
|
{
|
||||||
|
return boost::python::object( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
return boost::python::object();
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::python::object
|
||||||
|
loadPtrByPtr( ULONG64 address );
|
||||||
|
|
||||||
|
|
||||||
boost::python::object
|
boost::python::object
|
||||||
loadPtrArray( ULONG64 address, ULONG number );
|
loadPtrArray( ULONG64 address, ULONG number );
|
||||||
|
|
||||||
|
@ -70,11 +70,6 @@ loadTypedVar( const std::string &moduleName, const std::string &typeName, ULONG6
|
|||||||
|
|
||||||
ULONG64 moduleBase;
|
ULONG64 moduleBase;
|
||||||
|
|
||||||
if ( typeName.find("*") < typeName.size() )
|
|
||||||
{
|
|
||||||
return valueLoader<void*>( address, ptrSize() );
|
|
||||||
}
|
|
||||||
|
|
||||||
hres = dbgExt->symbols->GetModuleByModuleName( moduleName.c_str(), 0, NULL, &moduleBase );
|
hres = dbgExt->symbols->GetModuleByModuleName( moduleName.c_str(), 0, NULL, &moduleBase );
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugSymbol::GetModuleByModuleName failed" );
|
throw DbgException( "IDebugSymbol::GetModuleByModuleName failed" );
|
||||||
@ -117,7 +112,16 @@ loadTypedVar( const std::string &moduleName, const std::string &typeName, ULONG6
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var.attr( fieldName ) = loadTypedVar( moduleName, fieldTypeName, address + fieldOffset );
|
std::string fieldTypeNameStr( fieldTypeName );
|
||||||
|
|
||||||
|
if ( fieldTypeNameStr.find("*") < fieldTypeNameStr.size() )
|
||||||
|
{
|
||||||
|
var.attr( fieldName ) = valueLoader<void*>( address + fieldOffset, fieldSize );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var.attr( fieldName ) = loadTypedVar( moduleName, fieldTypeName, address + fieldOffset );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user