mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 21:03:23 +08:00
[0.2.x] ~ref: one memory read routine
git-svn-id: https://pykd.svn.codeplex.com/svn@80213 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
212a79fb7a
commit
90f6329bec
@ -5,8 +5,7 @@ namespace pykd {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
ULONG64 addr64( ULONG64 offset );
|
ULONG64 addr64( ULONG64 offset );
|
||||||
HRESULT readMemoryImpl(ULONG64 offset, PVOID buffer, ULONG length, ULONG *readed = NULL, bool phyAddr = false);
|
void readMemory( ULONG64 offset, PVOID buffer, ULONG length, bool phyAddr = FALSE, ULONG *readed = NULL );
|
||||||
void readMemory( ULONG64 offset, PVOID buffer, ULONG length, bool phyAddr = FALSE );
|
|
||||||
bool isVaValid( ULONG64 addr );
|
bool isVaValid( ULONG64 addr );
|
||||||
bool compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length, bool phyAddr = FALSE );
|
bool compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length, bool phyAddr = FALSE );
|
||||||
|
|
||||||
|
@ -125,12 +125,24 @@ public:
|
|||||||
/* [out] */ DWORD *pcbData,
|
/* [out] */ DWORD *pcbData,
|
||||||
/* [size_is][out] */ BYTE *pbData
|
/* [size_is][out] */ BYTE *pbData
|
||||||
) override {
|
) override {
|
||||||
return
|
|
||||||
readMemoryImpl(
|
try
|
||||||
|
{
|
||||||
|
readMemory(
|
||||||
m_loadBase + relativeVirtualAddress,
|
m_loadBase + relativeVirtualAddress,
|
||||||
pbData,
|
pbData,
|
||||||
cbData,
|
cbData,
|
||||||
|
FALSE,
|
||||||
pcbData);
|
pcbData);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
catch( const MemoryException &except )
|
||||||
|
{
|
||||||
|
DBG_UNREFERENCED_LOCAL_VARIABLE(except);
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -62,11 +62,12 @@ bool isVaValid( ULONG64 addr )
|
|||||||
|
|
||||||
return offsetInfo != DEBUG_VSOURCE_INVALID;
|
return offsetInfo != DEBUG_VSOURCE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
HRESULT readMemoryImpl(ULONG64 offset, PVOID buffer, ULONG length, ULONG *readed, bool phyAddr)
|
void readMemory( ULONG64 offset, PVOID buffer, ULONG length, bool phyAddr, ULONG *readed )
|
||||||
{
|
{
|
||||||
|
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
||||||
|
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
if ( phyAddr == false )
|
if ( phyAddr == false )
|
||||||
{
|
{
|
||||||
@ -85,17 +86,6 @@ HRESULT readMemoryImpl(ULONG64 offset, PVOID buffer, ULONG length, ULONG *readed
|
|||||||
hres = g_dbgEng->dataspace->ReadPhysical( offset, buffer, length, readed );
|
hres = g_dbgEng->dataspace->ReadPhysical( offset, buffer, length, readed );
|
||||||
}
|
}
|
||||||
|
|
||||||
return hres;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void readMemory( ULONG64 offset, PVOID buffer, ULONG length, bool phyAddr )
|
|
||||||
{
|
|
||||||
PyThread_StateRestore pyThreadRestore( g_dbgEng->pystate );
|
|
||||||
|
|
||||||
HRESULT hres = readMemoryImpl(offset, buffer, length, NULL, phyAddr);
|
|
||||||
|
|
||||||
if ( FAILED( hres ) )
|
if ( FAILED( hres ) )
|
||||||
throw MemoryException( offset, phyAddr );
|
throw MemoryException( offset, phyAddr );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user