feat(Hooking/Pointers): Added increment stat event hook to block reports

This commit is contained in:
Yimura 2020-12-27 18:29:33 +01:00
parent f1bb386b37
commit 52ac638a90
6 changed files with 44 additions and 1 deletions

View File

@ -10,6 +10,7 @@ namespace big::functions
using fix_vectors_t = void(*)(rage::scrNativeCallContext*);
using error_screen = void(char* entryHeader, char* entryLine1, int instructionalKey, char* entryLine2, BOOL p4, Any p5, Any* p6, Any* p7, BOOL background);
using increment_stat_event = bool(uint64_t net_event_struct, int64_t sender, int64_t a3);
using get_player_name = char*(Player player);
using sync_local_time_t = void(int h, int m);
}

View File

@ -39,7 +39,8 @@ namespace big
m_run_script_threads_hook("Script hook", g_pointers->m_run_script_threads, &hooks::run_script_threads),
m_convert_thread_to_fiber_hook("ConvertThreadToFiber", memory::module("kernel32.dll").get_export("ConvertThreadToFiber").as<void*>(), &hooks::convert_thread_to_fiber),
m_error_screen_hook("Disable Warning/Error Screen", g_pointers->m_error_screen, &hooks::error_screen)
m_error_screen_hook("Disable Warning/Error Screen", g_pointers->m_error_screen, &hooks::error_screen),
m_increment_stat_hook("Increment Stat Event", g_pointers->m_increment_stat_event, &hooks::increment_stat_event)
{
m_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present);
m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers);
@ -66,6 +67,7 @@ namespace big
// New hooks enable
m_error_screen_hook.enable();
m_increment_stat_hook.enable();
m_enabled = true;
}
@ -83,6 +85,7 @@ namespace big
// New hooks disable
m_error_screen_hook.disable();
m_increment_stat_hook.disable();
}
minhook_keepalive::minhook_keepalive()

View File

@ -23,6 +23,7 @@ namespace big
// New Hook Definitions
static void error_screen(char* entryHeader, char* entryLine1, int instructionalKey, char* entryLine2, BOOL p4, Any p5, Any* p6, Any* p7, BOOL background);
static bool increment_stat_event(uint64_t net_event_struct, int64_t sender, int64_t a3);
};
struct minhook_keepalive
@ -54,6 +55,7 @@ namespace big
// New Detour Hook Definitions
detour_hook m_error_screen_hook;
detour_hook m_increment_stat_hook;
};
inline hooking *g_hooking{};

View File

@ -0,0 +1,31 @@
#include "hooking.hpp"
#include "natives.hpp"
#include "features/notify.hpp"
namespace big
{
bool hooks::increment_stat_event(uint64_t net_event_struct, int64_t sender, int64_t a3)
{
Hash hash = *reinterpret_cast<DWORD*>(net_event_struct + 0x30);
Player sender_id = *reinterpret_cast<uint16_t*>(sender + 0x2D);
switch (hash)
{
case RAGE_JOAAT("MPPLY_GAME_EXPLOITS"):
case RAGE_JOAAT("MPPLY_VC_HATE"):
case RAGE_JOAAT("MPPLY_EXPLOITS"):
case RAGE_JOAAT("MPPLY_TC_ANNOYINGME"):
case RAGE_JOAAT("MPPLY_TC_HATE"):
char report[64];
strcpy(report, "Blocked report from <C>");
strcat(report, PLAYER::GET_PLAYER_NAME(sender_id));
strcat(report, "</C>");
features::notify::above_map(report);
return true;
}
return g_hooking->m_increment_stat_hook.get_original<decltype(&increment_stat_event)>()(net_event_struct, sender, a3);
}
}

View File

@ -88,6 +88,11 @@ namespace big
m_error_screen = ptr.as<decltype(m_error_screen)>();
});
main_batch.add("Increment Stat Event", "48 89 5C 24 ? 48 89 74 24 ? 55 57 41 55 41 56 41 57 48 8B EC 48 83 EC 60 8B 79 30", [this](memory::handle ptr)
{
m_increment_stat_event = ptr.as<decltype(m_increment_stat_event)>();
});
main_batch.run(memory::module(nullptr));
m_hwnd = FindWindowW(L"grcWindow", nullptr);

View File

@ -37,6 +37,7 @@ namespace big
functions::error_screen* m_error_screen{};
functions::get_player_name* m_get_player_name{};
functions::increment_stat_event* m_increment_stat_event{};
functions::sync_local_time_t* m_sync_local_time{};
};