fix breakpoints on Wine

This commit is contained in:
m 2024-06-03 12:37:53 -05:00
parent 7a011437d7
commit 76d291edd7
2 changed files with 29 additions and 14 deletions

View File

@ -13,6 +13,10 @@
#include "breakpoints.hpp"
#include "illegal_instructions.hpp"
#ifdef DEBUG
//#define PATCH_BREAKPOINTS
#endif
#define PRECOMPUTED_INTEGRITY_CHECKS
#define PRECOMPUTED_BREAKPOINTS
#define PRECOMPUTED_ILLEGAL_INSTRUCTIONS
@ -473,6 +477,7 @@ namespace arxan
utils::hook::jump(game_address, stub, false);
}
#ifdef PATCH_BREAKPOINTS
#ifdef PRECOMPUTED_BREAKPOINTS
void patch_breakpoints_precomputed()
{
@ -632,6 +637,7 @@ namespace arxan
handle_handler[handle] = nullptr;
return RemoveVectoredExceptionHandler(handle);
}
#endif
}
}
using namespace anti_debug;
@ -645,7 +651,11 @@ namespace arxan
{
return set_thread_context_stub;
}
else if (function == "AddVectoredExceptionHandler")
#ifdef PATCH_BREAKPOINTS
if (!utils::nt::is_wine())
{
if (function == "AddVectoredExceptionHandler")
{
return exceptions::add_vectored_exception_handler_stub;
}
@ -653,6 +663,8 @@ namespace arxan
{
return exceptions::remove_vectored_exception_handler_stub;
}
}
#endif
return nullptr;
}
@ -664,7 +676,10 @@ namespace arxan
remove_hardware_breakpoints();
hide_being_debugged();
scheduler::loop(hide_being_debugged, scheduler::pipeline::async);
if (!utils::nt::is_wine())
{
store_debug_functions();
}
const utils::nt::library ntdll("ntdll.dll");
nt_close_hook.create(ntdll.get_proc<void*>("NtClose"), nt_close_stub);
@ -682,8 +697,11 @@ namespace arxan
remove_hardware_breakpoints();
search_and_patch_integrity_checks();
if (!utils::nt::is_wine())
{
restore_debug_functions();
}
}
component_priority priority() override
{

View File

@ -67,15 +67,12 @@ namespace system_check
void verify_binary_version()
{
const auto value = *reinterpret_cast<DWORD*>(0x1337_b);
if (!utils::nt::is_wine())
{
if (value != 0xB43C9275)
if (!utils::nt::is_wine() && value != 0xB43C9275)
{
throw std::runtime_error("Unsupported Call of Duty: Infinite Warfare version");
}
}
}
}
bool is_valid()
{