mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +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 );
|
||||
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 );
|
||||
void readMemory( ULONG64 offset, PVOID buffer, ULONG length, bool phyAddr = FALSE, ULONG *readed = NULL );
|
||||
bool isVaValid( ULONG64 addr );
|
||||
bool compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length, bool phyAddr = FALSE );
|
||||
|
||||
|
@ -125,12 +125,24 @@ public:
|
||||
/* [out] */ DWORD *pcbData,
|
||||
/* [size_is][out] */ BYTE *pbData
|
||||
) override {
|
||||
return
|
||||
readMemoryImpl(
|
||||
|
||||
try
|
||||
{
|
||||
readMemory(
|
||||
m_loadBase + relativeVirtualAddress,
|
||||
pbData,
|
||||
cbData,
|
||||
FALSE,
|
||||
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;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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;
|
||||
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 );
|
||||
}
|
||||
|
||||
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 ) )
|
||||
throw MemoryException( offset, phyAddr );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user