mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-05-13 22:23:24 +08:00
[+] added: physical memory read support ( for loadBytes, loadWords etc)
git-svn-id: https://pykd.svn.codeplex.com/svn@56418 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
477da2e29f
commit
7831603e21
@ -10,15 +10,25 @@ using namespace std;
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool
|
bool
|
||||||
loadMemory( ULONG64 address, PVOID dest, ULONG length )
|
loadMemory( ULONG64 address, PVOID dest, ULONG length, BOOLEAN phyAddr )
|
||||||
{
|
{
|
||||||
address = addr64( address );
|
address = addr64( address );
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
HRESULT hres = dbgExt->dataSpaces->ReadVirtual( address, dest, length, NULL );
|
if ( phyAddr == FALSE )
|
||||||
if ( FAILED( hres ) )
|
{
|
||||||
throw DbgException( "IDebugDataSpace::ReadVirtual failed" );
|
HRESULT hres = dbgExt->dataSpaces->ReadVirtual( address, dest, length, NULL );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugDataSpace::ReadVirtual failed" );
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HRESULT hres = dbgExt->dataSpaces->ReadPhysical( address, dest, length, NULL );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugDataSpace::ReadPhysical failed" );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -49,7 +59,7 @@ addr64( ULONG64 addr )
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool
|
bool
|
||||||
compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length )
|
compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length, BOOLEAN phyAddr )
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
@ -62,13 +72,27 @@ compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length )
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
hres = dbgExt->dataSpaces->ReadVirtual( addr1, m1, length, NULL );
|
if ( phyAddr == FALSE )
|
||||||
if ( FAILED( hres ) )
|
{
|
||||||
throw DbgException( "IDebugDataSpace::ReadVirtual failed" );
|
|
||||||
|
hres = dbgExt->dataSpaces->ReadVirtual( addr1, m1, length, NULL );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugDataSpace::ReadVirtual failed" );
|
||||||
|
|
||||||
hres = dbgExt->dataSpaces->ReadVirtual( addr2, m2, length, NULL );
|
hres = dbgExt->dataSpaces->ReadVirtual( addr2, m2, length, NULL );
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw DbgException( "IDebugDataSpace::ReadVirtual failed" );
|
throw DbgException( "IDebugDataSpace::ReadVirtual failed" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hres = dbgExt->dataSpaces->ReadPhysical( addr1, m1, length, NULL );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugDataSpace::ReadPhysical failed" );
|
||||||
|
|
||||||
|
hres = dbgExt->dataSpaces->ReadPhysical( addr2, m2, length, NULL );
|
||||||
|
if ( FAILED( hres ) )
|
||||||
|
throw DbgException( "IDebugDataSpace::ReadPhysical failed" );
|
||||||
|
}
|
||||||
|
|
||||||
result = memcmp( m1, m2, length ) == 0;
|
result = memcmp( m1, m2, length ) == 0;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool
|
bool
|
||||||
loadMemory( ULONG64 address, PVOID dest, ULONG length );
|
loadMemory( ULONG64 address, PVOID dest, ULONG length, BOOLEAN phyAddr = FALSE );
|
||||||
|
|
||||||
ULONG64
|
ULONG64
|
||||||
loadPtrByPtr( ULONG64 address );
|
loadPtrByPtr( ULONG64 address );
|
||||||
@ -15,11 +15,11 @@ loadPtrByPtr( ULONG64 address );
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
boost::python::object
|
boost::python::object
|
||||||
loadArray( ULONG64 address, ULONG number )
|
loadArray( ULONG64 address, ULONG number, BOOLEAN phyAddr = FALSE )
|
||||||
{
|
{
|
||||||
T *buffer = new T[ number ];
|
T *buffer = new T[ number ];
|
||||||
|
|
||||||
if ( loadMemory( address, buffer, number*sizeof(T) ) )
|
if ( loadMemory( address, buffer, number*sizeof(T), phyAddr ) )
|
||||||
{
|
{
|
||||||
boost::python::dict arr;
|
boost::python::dict arr;
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ boost::python::object
|
|||||||
loadAnsiStr( ULONG64 address );
|
loadAnsiStr( ULONG64 address );
|
||||||
|
|
||||||
bool
|
bool
|
||||||
compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length );
|
compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length, BOOLEAN phyAddr = FALSE );
|
||||||
|
|
||||||
ULONG64
|
ULONG64
|
||||||
addr64( ULONG64 addr );
|
addr64( ULONG64 addr );
|
||||||
|
Loading…
Reference in New Issue
Block a user