Commit 5be28cda authored by ussrhero's avatar ussrhero

added getVaState, getVaType

parent e24cbc85
......@@ -134,7 +134,6 @@ enum FileFlag {
};
enum MemoryProtect {
PageNoAccess = 0x00000001,
PageReadOnly = 0x00000002,
PageReadWrite = 0x00000004,
......@@ -145,6 +144,17 @@ enum MemoryProtect {
PageExecuteWriteCopy = 0x00000080
};
enum MemoryState {
MemCommit = 0x1000,
MemReserve = 0x2000,
MemFree = 0x10000
};
enum MemoryType {
MemPrivate = 0x20000,
MemMapped = 0x40000,
MemImage = 0x1000000
};
enum ProcessExitReason {
ProcessExit,
......
......@@ -19,6 +19,9 @@ bool compareMemory( MEMOFFSET_64 addr1, MEMOFFSET_64 addr2, size_t length, bool
MEMOFFSET_64 searchMemory( MEMOFFSET_64 beginOffset, unsigned long length, const std::vector<char>& pattern );
MEMOFFSET_64 findMemoryRegion( MEMOFFSET_64 beginOffset, MEMOFFSET_64& regionOffset, unsigned long long &regionLength );
kdlib::MemoryProtect getVaProtect( kdlib::MEMOFFSET_64 offset );
kdlib::MemoryState getVaState( kdlib::MEMOFFSET_64 offset );
kdlib::MemoryType getVaType( kdlib::MEMOFFSET_64 offset );
void writeMemory( MEMOFFSET_64 offset, const void* buffer, size_t length, bool phyAddr = false, unsigned long *written = 0 );
......
......@@ -336,5 +336,39 @@ kdlib::MemoryProtect getVaProtect( kdlib::MEMOFFSET_64 offset )
///////////////////////////////////////////////////////////////////////////////
kdlib::MemoryState getVaState(kdlib::MEMOFFSET_64 offset)
{
offset = addr64(offset);
HRESULT hres;
MEMORY_BASIC_INFORMATION64 meminfo = {};
hres = g_dbgMgr->dataspace->QueryVirtual(offset, &meminfo);
if (FAILED(hres))
throw MemoryException(offset);
return static_cast<MemoryState>(meminfo.State);
}
///////////////////////////////////////////////////////////////////////////////
kdlib::MemoryType getVaType(kdlib::MEMOFFSET_64 offset)
{
offset = addr64(offset);
HRESULT hres;
MEMORY_BASIC_INFORMATION64 meminfo = {};
hres = g_dbgMgr->dataspace->QueryVirtual(offset, &meminfo);
if (FAILED(hres))
throw MemoryException(offset);
return static_cast<MemoryType>(meminfo.Type);
}
///////////////////////////////////////////////////////////////////////////////
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment