summaryrefslogtreecommitdiff
path: root/csgo-loader/csgo-client/Security/RuntimeSecurity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'csgo-loader/csgo-client/Security/RuntimeSecurity.cpp')
-rw-r--r--csgo-loader/csgo-client/Security/RuntimeSecurity.cpp29
1 files changed, 29 insertions, 0 deletions
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 <Security/RuntimeSecurity.hpp>
+#include <UserExperience/UserInterface.hpp>
+
+// Global accessor to security instance.
+Security::RuntimeSecurityPtr Protection = std::make_unique<Security::RuntimeSecurity>();
+
+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