windows-nt/Source/XPSP1/NT/com/ole32/dcomss/actdbg/memory.cxx

51 lines
1.1 KiB
C++
Raw Normal View History

2020-09-26 03:20:57 -05:00
/*
*
* memory.cxx
*
* Routines for reading/writing process memory.
*
*/
#include "actdbg.hxx"
BOOL
ReadMemory(
IN PNTSD_EXTENSION_APIS pExtApis,
IN HANDLE hProcess,
IN DWORD_PTR Address,
IN OUT void * pBuffer,
IN DWORD BufferSize
)
{
SIZE_T BytesRead;
BOOL bStatus;
if ( ! Address )
return FALSE;
bStatus = ReadProcessMemory(
hProcess,
(const void *)Address,
pBuffer,
BufferSize,
&BytesRead );
return bStatus && (BytesRead == BufferSize);
}
BOOL
ReadMemory(
IN PNTSD_EXTENSION_APIS pExtApis,
IN HANDLE hProcess,
IN char * pszAddress,
IN OUT void * pBuffer,
IN DWORD BufferSize
)
{
DWORD_PTR Address;
Address = (*pExtApis->lpGetExpressionRoutine)( pszAddress );
return ReadMemory( pExtApis, hProcess, Address, pBuffer, BufferSize );
}