added isdebugging boolean, fixed a bug in Process.Memory with the bytesRead and bytesWritten parameters

This commit is contained in:
mrexodia 2015-12-20 06:22:46 +01:00
parent ce7626a380
commit c776b85f19
3 changed files with 12 additions and 3 deletions

View File

@ -6,6 +6,7 @@ namespace GleeBug
{
//initialize loop variables
_breakDebugger = false;
_isDebugging = true;
while (!_breakDebugger)
{
@ -104,5 +105,6 @@ namespace GleeBug
//cleanup
_processes.clear();
_process = nullptr;
_isDebugging = false;
}
};

View File

@ -4,12 +4,15 @@ namespace GleeBug
{
bool ProcessInfo::MemRead(ptr address, void* buffer, ptr size, ptr* bytesRead) const
{
return !!ReadProcessMemory(this->hProcess, reinterpret_cast<const void*>(address), buffer, size, nullptr);
ptr read;
if (!bytesRead)
bytesRead = &read;
return !!ReadProcessMemory(this->hProcess, reinterpret_cast<const void*>(address), buffer, size, (SIZE_T*)bytesRead);
}
bool ProcessInfo::MemReadSafe(ptr address, void* buffer, ptr size, ptr* bytesRead) const
{
if (!MemRead(address, buffer, size))
if (!MemRead(address, buffer, size, bytesRead))
return false;
//choose the filter method that has the lowest cost
@ -53,7 +56,10 @@ namespace GleeBug
bool ProcessInfo::MemWrite(ptr address, const void* buffer, ptr size, ptr* bytesWritten)
{
return !!WriteProcessMemory(this->hProcess, reinterpret_cast<void*>(address), buffer, size, nullptr);
ptr written;
if (!bytesWritten)
bytesWritten = &written;
return !!WriteProcessMemory(this->hProcess, reinterpret_cast<void*>(address), buffer, size, (SIZE_T*)bytesWritten);
}
bool ProcessInfo::MemWriteSafe(ptr address, const void* buffer, ptr size, ptr* bytesWritten)

View File

@ -249,6 +249,7 @@ namespace GleeBug
DEBUG_EVENT _debugEvent;
ProcessMap _processes;
bool _isRunning = false;
bool _isDebugging = false;
/**
\brief The current process (can be null in some cases).