summaryrefslogtreecommitdiff
path: root/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp
diff options
context:
space:
mode:
authorboris <wzn@moneybot.cc>2018-12-27 22:42:05 +1300
committerboris <wzn@moneybot.cc>2018-12-27 22:42:05 +1300
commit0c194bc8046cb3ecb4e4d0577f36a1d3bde58d11 (patch)
treec27c5e71dba4db816cd9ad601a997b974377187e /csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp
parent45adf172a76fc46ca6ca10e17fd534d4f35896c0 (diff)
bap
Diffstat (limited to 'csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp')
-rw-r--r--csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp b/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp
index 8d2509f..6893498 100644
--- a/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp
+++ b/csgo-loader/csgo-client/RemoteCode/RemoteProcess.cpp
@@ -29,6 +29,10 @@ namespace RemoteCode
// swoo
m_ProcessId = ProcessEntry.th32ProcessID;
m_Process = OpenProcess(PROCESS_ALL_ACCESS, false, ProcessEntry.th32ProcessID);
+
+ if(!m_Process)
+ ERROR_ASSERT("[000G:%08x] There was an error with accessing a process.", GetLastError());
+
return true;
}
}
@@ -40,13 +44,19 @@ namespace RemoteCode
void RemoteProcess::ReadMemoryWrapper_Internal(void *Address, void *Data, size_t SizeOfData)
{
static auto ZwReadVirtualMemory = Syscalls->Find<long(__stdcall *)(void *, void *, void *, size_t, void *)>(FNV("ZwReadVirtualMemory"));
- ZwReadVirtualMemory(m_Process, Address, Data, SizeOfData, nullptr);
+ NTSTATUS Status = ZwReadVirtualMemory(m_Process, Address, Data, SizeOfData, nullptr);
+
+ if(NT_ERROR(Status))
+ ERROR_ASSERT("[00DF:%08x] There was an error with accessing a process.", Status);
}
void RemoteProcess::WriteMemoryWrapper_Internal(void *Address, void *Data, size_t SizeOfData)
{
static auto ZwWriteVirtualMemory = Syscalls->Find<long(__stdcall *)(void *, void *, void *, size_t, void *)>(FNV("ZwWriteVirtualMemory"));
- ZwWriteVirtualMemory(m_Process, Address, Data, SizeOfData, nullptr);
+ NTSTATUS Status = ZwWriteVirtualMemory(m_Process, Address, Data, SizeOfData, nullptr);
+
+ if(NT_ERROR(Status))
+ ERROR_ASSERT("[00DF:%08x] There was an error with accessing a process.", Status);
}
void *RemoteProcess::Allocate(size_t AllocationSize)
@@ -64,8 +74,8 @@ namespace RemoteCode
PAGE_EXECUTE_READWRITE
);
- if(!NT_SUCCESS(Status))
- return nullptr;
+ if(NT_ERROR(Status))
+ ERROR_ASSERT("[00DF:%08x] There was an error with accessing a process.", Status);
return AllocationAddress;
}
@@ -85,9 +95,11 @@ namespace RemoteCode
while(Module32Next(Toolhelp, &ModuleEntry))
{
- //printf("%s\n", ModuleEntry.szModule);
if(strstr(ModuleEntry.szModule, ModuleName))
{
+ if(!ModuleEntry.hModule)
+ ERROR_ASSERT("[00DF:00001C00] An integrity check failed.");
+
CloseHandle(Toolhelp);
return RemoteModule(ModuleEntry.hModule);
}