diff --git a/StaticEngine/ntdll.h b/StaticEngine/ntdll.h index 0ac4245..00ea14c 100644 --- a/StaticEngine/ntdll.h +++ b/StaticEngine/ntdll.h @@ -244,7 +244,7 @@ typedef struct __PUBLIC_OBJECT_TYPE_INFORMATION typedef struct _PROCESS_BASIC_INFORMATION { - PVOID Reserved1; + NTSTATUS ExitStatus; PVOID PebBaseAddress; PVOID Reserved2[2]; ULONG_PTR UniqueProcessId; diff --git a/TitanEngineEmulator/Emulator.h b/TitanEngineEmulator/Emulator.h index 9d95801..35dae23 100644 --- a/TitanEngineEmulator/Emulator.h +++ b/TitanEngineEmulator/Emulator.h @@ -98,7 +98,10 @@ public: { auto process = processFromHandle(hProcess); if(!process) - return false; + { + // This happens when reading from a process not being debugged + return !!ReadProcessMemory(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead); + } return process->MemReadSafe(ptr(lpBaseAddress), lpBuffer, nSize, (ptr*)lpNumberOfBytesRead); } @@ -106,7 +109,10 @@ public: { auto process = processFromHandle(hProcess); if(!process) - return false; + { + // This happens when writing to a process not being debugged + return !!WriteProcessMemory(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesWritten); + } return process->MemWriteSafe(ptr(lpBaseAddress), lpBuffer, nSize, (ptr*)lpNumberOfBytesWritten); }