From 0c194bc8046cb3ecb4e4d0577f36a1d3bde58d11 Mon Sep 17 00:00:00 2001 From: boris Date: Thu, 27 Dec 2018 22:42:05 +1300 Subject: bap --- .../csgo-client/Security/RuntimeSecurity.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 csgo-loader/csgo-client/Security/RuntimeSecurity.cpp (limited to 'csgo-loader/csgo-client/Security/RuntimeSecurity.cpp') diff --git a/csgo-loader/csgo-client/Security/RuntimeSecurity.cpp b/csgo-loader/csgo-client/Security/RuntimeSecurity.cpp new file mode 100644 index 0000000..305a44f --- /dev/null +++ b/csgo-loader/csgo-client/Security/RuntimeSecurity.cpp @@ -0,0 +1,29 @@ +#include +#include + +// Global accessor to security instance. +Security::RuntimeSecurityPtr Protection = std::make_unique(); + +namespace Security +{ + decltype(&MessageBoxA) oMessageBox; + int __stdcall Hooked_MessageBox(HWND Window, char *Message, char *Caption, uint32_t Type) + { + MEMORY_BASIC_INFORMATION Query; + if(!VirtualQuery(_ReturnAddress(), &Query, sizeof MEMORY_BASIC_INFORMATION)) + ERROR_ASSERT("[00DF:00002C00] An integrity check failed."); + + return oMessageBox(Window, Message, Caption, Type); + } + + bool RuntimeSecurity::Start() + { + if(MH_Initialize() != MH_OK) + return false; + + MH_CreateHook(&MessageBoxA, Hooked_MessageBox, (void **)&oMessageBox); + MH_EnableHook(&MessageBoxA); + + return true; + } +} \ No newline at end of file -- cgit v1.2.3