#include void* __fastcall hooks::api::add_veh_handler(ulong first, void* handler) { auto* const original_fn = o::api_::add_veh_handler; log_mon_call("()"); if (r5::is_within_eac(_ReturnAddress())) { g::p::on_ac_event(0xF01); log_info_("blocking EAC attempt to register VEH handler."); return nullptr; } return original_fn(first, handler); } ulong __fastcall hooks::api::remove_veh_handler(void* handle) { auto* const original_fn = o::api_::remove_veh_handler; log_mon_call("()"); return original_fn(handle); } ulong __fastcall hooks::api::query_info_thread( _handle thread, THREADINFOCLASS info_class, void* info_buffer, ulong info_length, ulong* return_length ) { auto* const original_fn = o::api_::query_info_thread; log_mon_call("()"); if (r5::is_within_eac(_ReturnAddress())) { g::p::on_ac_event(0xF02); log_info_("blocking call to query info thread from EAC."); return STATUS_ACCESS_VIOLATION; } return original_fn( thread, info_class, info_buffer, info_length, return_length ); } int __fastcall hooks::api::get_thread_context(_handle thread, CONTEXT* ctx) { auto* const original_fn = o::api_::get_thread_context; log_mon_call("()"); return original_fn(thread, ctx); } ulong __fastcall hooks::api::device_ioctl_file( _handle file_handle, _handle event, PIO_APC_ROUTINE apc_routine, PVOID apc_ctx, PIO_STATUS_BLOCK iosb, ulong ioctl_code, PVOID input_buffer, ULONG input_buffer_len, PVOID output_buffer, ULONG output_buffer_len ) { auto* const original_fn = o::api_::device_ioctl_file; return original_fn( file_handle, event, apc_routine, apc_ctx, iosb, ioctl_code, input_buffer, input_buffer_len, output_buffer, output_buffer_len ); } int __fastcall hooks::api::translate_message(PMSG msg) { auto* const original_fn = o::api_::translate_message; r5::on_window_proc(msg->message, msg->wParam, msg->lParam); return original_fn(msg); } __forceinline bool file_header_to_info(uintptr_t address, hvi::module_info_ex* result) { auto my_context = g::p::context; auto eac_context = g::p::acc::eac; if (my_context && my_context->m_initialized) { auto my_begin = g::p::context->my_base; auto my_end = my_begin + g::p::context->my_length; if (address >= my_begin && address <= my_end) { result->base = my_begin; result->length = g::p::context->my_length; stl::wcscpy(result->name, _XSW(L"game_r5.dll")); return true; } } if (eac_context && eac_context->launched && eac_context->internal_module.found) { auto im_begin = eac_context->internal_module.base; auto im_end = im_begin + eac_context->internal_module.length; if (address >= im_begin && address <= im_end) { result->base = im_begin; result->length = eac_context->internal_module.length; stl::wcscpy(result->name, _XSW(L"eac_internal.dll")); return true; } } auto list = stl::vector(); if (hvi::get_module_list(win_api::get_current_process_id(), list)) { for (auto i = 0ull; i < list.size(); i++) { const auto& mod = list[i]; auto mod_begin = mod.base; auto mod_end = mod_begin + mod.length; if (address >= mod_begin && address <= mod_end) { result->base = mod_begin; result->length = mod.length; stl::wcscpy(result->name, mod.name); return true; } } } return false; } void __fastcall hooks::api::user_exception_dispatcher(PEXCEPTION_RECORD record, PCONTEXT context) { constexpr auto capture_exceptions = false; hvi::module_info_ex exception_module{ }; bool module_found = file_header_to_info(context->Rip, &exception_module); if (!capture_exceptions) return; char fmt[256]; util::format_string( fmt, sizeof(fmt), _XS("CODE = %p | RIP_RAW = %p | MODULE = %ls | RVA = %p \n"), record->ExceptionCode, context->Rip, module_found ? exception_module.name : _XSW(L"N/A"), (context->Rip - exception_module.base) ); util::write_data(fmt, _XSW(L"C:/Users/Berkan/Desktop/EX/ed.txt")); }