From e1f048c8f922613aec1f63791c2191e55cbd5132 Mon Sep 17 00:00:00 2001 From: boris Date: Thu, 3 Jan 2019 16:51:40 +1300 Subject: ricardo milos :DDDD::D:D:D: --- .../csgo-client/RemoteCode/RemoteProcess.cpp | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp') diff --git a/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp b/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp index abed829..1bbfed0 100644 --- a/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp +++ b/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp @@ -29,6 +29,10 @@ namespace RemoteCode m_ProcessId = ProcessEntry.th32ProcessID; m_Process = OpenProcess(PROCESS_ALL_ACCESS, false, ProcessEntry.th32ProcessID); + WRAP_IF_DEBUG( + printf("[DEBUG] Found process \"%s\" -> %p", ProcessEntry.szExeFile, m_Process); + ); + if(!m_Process) ERROR_ASSERT(STR("[000G:%08x] There was an error with accessing a process."), GetLastError()); @@ -45,9 +49,13 @@ namespace RemoteCode static auto ZwReadVirtualMemory = Syscalls->Find(FNV("ZwReadVirtualMemory")); NTSTATUS Status = ZwReadVirtualMemory(m_Process, Address, Data, SizeOfData, nullptr); - + if(NT_ERROR(Status)) ERROR_ASSERT(STR("[00DF:%08x] There was an error with accessing a process."), Status); + + WRAP_IF_DEBUG( + printf("[DEBUG] Read %zd bytes from process\n", SizeOfData); + ); } void RemoteProcess::WriteMemoryWrapper_Internal(void *Address, void *Data, size_t SizeOfData) @@ -58,6 +66,10 @@ namespace RemoteCode if(NT_ERROR(Status)) ERROR_ASSERT(STR("[00DF:%08x] There was an error with accessing a process."), Status); + + WRAP_IF_DEBUG( + printf("[DEBUG] Wrote %zd bytes to process\n", SizeOfData); + ); } void *RemoteProcess::Allocate(size_t AllocationSize) @@ -78,6 +90,10 @@ namespace RemoteCode if(NT_ERROR(Status)) ERROR_ASSERT(STR("[00DF:%08x] There was an error with accessing a process."), Status); + WRAP_IF_DEBUG( + printf("[DEBUG] Allocated page at %p (%zd bytes)\n", AllocationAddress, AllocationSize); + ); + return AllocationAddress; } @@ -101,6 +117,11 @@ namespace RemoteCode ERROR_ASSERT(STR("[00DF:00001C00] An integrity check failed.")); CloseHandle(Toolhelp); + + WRAP_IF_DEBUG( + printf("[DEBUG] Found module \"%s\" at %p\n", ModuleEntry.szModule, ModuleEntry.hModule); + ); + return RemoteModule(ModuleEntry.hModule); } } -- cgit v1.2.3