precomputed breakpoints

This commit is contained in:
quaK 2024-01-08 14:42:01 +02:00
parent 0fe367896d
commit dda06366e3
2 changed files with 613 additions and 3 deletions

View File

@ -10,8 +10,10 @@
#include <utils/string.hpp> #include <utils/string.hpp>
#include "integrity.hpp" #include "integrity.hpp"
#include "breakpoints.hpp"
#define PRECOMPUTED_INTEGRITY_CHECKS #define PRECOMPUTED_INTEGRITY_CHECKS
#define PRECOMPUTED_BREAKPOINTS
#define ProcessDebugPort 7 #define ProcessDebugPort 7
#define ProcessDebugObjectHandle 30 #define ProcessDebugObjectHandle 30
@ -450,7 +452,6 @@ namespace arxan
if (result) if (result)
{ {
memset(&fake_context, 0, sizeof(CONTEXT)); memset(&fake_context, 0, sizeof(CONTEXT));
//printf("Executed fake breakpoint\n");
break; break;
} }
} }
@ -482,7 +483,17 @@ namespace arxan
utils::hook::jump(game_address, stub, false); utils::hook::jump(game_address, stub, false);
} }
void patch() #ifdef PRECOMPUTED_BREAKPOINTS
void patch_breakpoints_precomputed()
{
for (const auto i : int2d_breakpoint_addresses)
{
patch_int2d_trap(reinterpret_cast<void*>(i));
}
}
#endif
void patch_breakpoints()
{ {
static bool once = false; static bool once = false;
if (once) if (once)
@ -493,6 +504,10 @@ namespace arxan
memset(&fake_context, 0, sizeof(CONTEXT)); memset(&fake_context, 0, sizeof(CONTEXT));
#ifdef PRECOMPUTED_BREAKPOINTS
assert(game::base_address == 0x140000000);
patch_breakpoints_precomputed();
#else
const auto int2d_results = utils::hook::signature("CD 2D E9 ? ? ? ?", game_module::get_game_module()).process(); const auto int2d_results = utils::hook::signature("CD 2D E9 ? ? ? ?", game_module::get_game_module()).process();
for (auto* i : int2d_results) for (auto* i : int2d_results)
{ {
@ -500,6 +515,7 @@ namespace arxan
} }
// the game seems to have int3 debugbreaks too but none seem to get triggered with int2d patch? // the game seems to have int3 debugbreaks too but none seem to get triggered with int2d patch?
#endif
} }
LONG NTAPI toplevel_handler_stub(EXCEPTION_POINTERS* info) LONG NTAPI toplevel_handler_stub(EXCEPTION_POINTERS* info)
@ -527,7 +543,7 @@ namespace arxan
first = 0; first = 0;
} }
breakpoints::patch(); breakpoints::patch_breakpoints();
auto handle = AddVectoredExceptionHandler(first, toplevel_handler_stub); auto handle = AddVectoredExceptionHandler(first, toplevel_handler_stub);
handle_handler[handle] = handler; handle_handler[handle] = handler;

View File

@ -0,0 +1,594 @@
#pragma once
#include <cstdint>
constexpr uint64_t int2d_breakpoint_addresses[] =
{
0x14004E569,
0x140069F29,
0x1400EFEA9,
0x1400F0FC9,
0x1403CE6D9,
0x1404ECC09,
0x1404F2539,
0x140524519,
0x140A50D69,
0x140BFA4D9,
0x140C1E049,
0x140C29999,
0x140C92BBE,
0x140CC0EF9,
0x140CEFFA9,
0x140CF0D79,
0x140CF241F,
0x140CF6A91,
0x140DB85A9,
0x140F138C9,
0x140F238E9,
0x140F24A89,
0x140F31AA9,
0x140F3D1A9,
0x140F58709,
0x1411049E9,
0x14117ADD0,
0x141216534,
0x14123991E,
0x14123B17E,
0x14124DA95,
0x14125842F,
0x1412632D5,
0x141267CBF,
0x1412697E4,
0x141286872,
0x141293C7F,
0x1412990AB,
0x14129A49E,
0x141303D54,
0x14131B345,
0x1413204BE,
0x141320571,
0x14132211F,
0x141379479,
0x141398E09,
0x1413B20E9,
0x14B2E246A,
0x14B2E5CA6,
0x14B2E6C7D,
0x14B2EAF29,
0x14B2F7DA3,
0x14B2F9D2E,
0x14B34FE91,
0x14B361E9D,
0x14B36397C,
0x14B36A32D,
0x14B378CA7,
0x14B37B194,
0x14B382645,
0x14B3888A3,
0x14B39618C,
0x14B39CD0C,
0x14B3A1ECE,
0x14B3A994B,
0x14B3AC9FF,
0x14B3AE79D,
0x14B3AF313,
0x14B3B16CF,
0x14B3B65C1,
0x14B3DA767,
0x14B3DC6B1,
0x14B3DD7E8,
0x14B3E340F,
0x14B3E8680,
0x14B3ED8F6,
0x14B3F590B,
0x14B3F5A29,
0x14B3F68EB,
0x14B3FCB09,
0x14B400C56,
0x14B412247,
0x14B4170F2,
0x14B4222E3,
0x14B426354,
0x14B434EB1,
0x14B438BC3,
0x14B439E43,
0x14B43BABC,
0x14B443781,
0x14B452BE4,
0x14B455B40,
0x14B45AAF3,
0x14B45CFC6,
0x14B46708E,
0x14B46B471,
0x14B46DFE6,
0x14B47218E,
0x14B47502B,
0x14B47FF6B,
0x14B489B5D,
0x14B4901F5,
0x14B493ED2,
0x14B497074,
0x14B499ADC,
0x14B49BB2A,
0x14B49F189,
0x14B49F2AE,
0x14B49FBC0,
0x14B4A5193,
0x14B4A9530,
0x14B4AAA35,
0x14B4AABC4,
0x14B4AD6E8,
0x14B4B3B31,
0x14B4B7B3D,
0x14B4B845B,
0x14B4BB7E6,
0x14B4BCCD6,
0x14B4C1AF6,
0x14B4C4AEA,
0x14B4C5B91,
0x14B4CCA65,
0x14B4D0F9C,
0x14B4D44D0,
0x14B4D7423,
0x14B5262AD,
0x14B52655E,
0x14B528DF2,
0x14B52BC8B,
0x14B53142D,
0x14B538901,
0x14B54520F,
0x14B5462B2,
0x14B5466A6,
0x14B54CF35,
0x14B54D44B,
0x14B550353,
0x14B555F0C,
0x14B55678C,
0x14B55F494,
0x14B563618,
0x14B564B29,
0x14B565CB9,
0x14B566DF3,
0x14B58085C,
0x14B58FA48,
0x14B59229B,
0x14B5944E4,
0x14B5A2E29,
0x14B5A3269,
0x14B5B05BF,
0x14B5B3D1B,
0x14B5BE2D9,
0x14B5C0A85,
0x14B5C32CF,
0x14B5C50F2,
0x14B5C67CD,
0x14B5C92EB,
0x14B5C9717,
0x14B5CE3A6,
0x14B5CEEE3,
0x14B626123,
0x14B626553,
0x14B633A3E,
0x14B63DF91,
0x14B648C4A,
0x14B64D55C,
0x14B64E48A,
0x14B6539B4,
0x14B666AC3,
0x14B66AD46,
0x14B66C669,
0x14B66CE05,
0x14B672AD5,
0x14B67EDC1,
0x14B68048C,
0x14B681119,
0x14B683347,
0x14B68691B,
0x14B6888BA,
0x14B691973,
0x14B6945F4,
0x14B7348B6,
0x14B73666A,
0x14B7398B2,
0x14B73E42F,
0x14B741BA5,
0x14B742DE8,
0x14B745CFB,
0x14B74827A,
0x14B74A230,
0x14B75124E,
0x14B751691,
0x14B760F53,
0x14B77032D,
0x14B7706AE,
0x14B778A13,
0x14B7794AF,
0x14B77BBFB,
0x14B785745,
0x14B788D32,
0x14B78DE47,
0x14B7910C9,
0x14B795294,
0x14B7A0DAB,
0x14B7A3B42,
0x14B7AC060,
0x14B7B5DA8,
0x14B7B64E5,
0x14B7BC9BF,
0x14B7BDB7E,
0x14B7BE77E,
0x14B7C5313,
0x14B7C8071,
0x14B7CA6E4,
0x14B7D3385,
0x14B7D43DD,
0x14B7D4C57,
0x14B7DD2AF,
0x14B7DE8C4,
0x14B7DED66,
0x14B7EE457,
0x14B7F5322,
0x14B7F6837,
0x14B7FDD66,
0x14B7FDFEE,
0x14B805299,
0x14B8052A0,
0x14B807827,
0x14B80A30B,
0x14B810D85,
0x14B81282F,
0x14B818622,
0x14B81C166,
0x14B820555,
0x14B8288BE,
0x14B86E751,
0x14B8760A6,
0x14B87D6FD,
0x14B8857AA,
0x14B889598,
0x14B894D05,
0x14B895BB9,
0x14B895BDA,
0x14B8967F2,
0x14B8E5641,
0x14B8E61D8,
0x14B8E6D08,
0x14B8E9516,
0x14B8E9784,
0x14B900442,
0x14B903DA2,
0x14B9518C3,
0x14B959CA1,
0x14B95DE5B,
0x14B9609C3,
0x14B963A1C,
0x14B9B86AE,
0x14B9C0892,
0x14B9C94CA,
0x14B9CAAB3,
0x14B9CD2F7,
0x14B9CE417,
0x14B9CFD20,
0x14B9DD84E,
0x14B9E31E7,
0x14B9E57B1,
0x14B9F1CB9,
0x14B9FFF1C,
0x14BA001F0,
0x14BA037EA,
0x14BA0787E,
0x14BA08886,
0x14BA10AEA,
0x14BA18A56,
0x14BA2368D,
0x14BA2454B,
0x14BA27998,
0x14BA281CE,
0x14BA2A34D,
0x14BA2A5FA,
0x14BA394BE,
0x14BA402BC,
0x14BA46451,
0x14BA4F657,
0x14BA50C3C,
0x14BA57A6A,
0x14BA5D5A0,
0x14BA6A7B2,
0x14BA76FA1,
0x14BA77D4E,
0x14BA7AA42,
0x14BA7AA8A,
0x14BA8640B,
0x14BA8E903,
0x14BA97CE7,
0x14BA98908,
0x14BAA1B64,
0x14BAA3F78,
0x14BAA4F8A,
0x14BAA7DC2,
0x14BAB299E,
0x14BAB3DCD,
0x14BAC35D6,
0x14BACBEB4,
0x14BACDE69,
0x14BAD7967,
0x14BADA669,
0x14BAF6257,
0x14BAFA589,
0x14BAFB6BF,
0x14BAFF6C5,
0x14BB007C0,
0x14BB039F2,
0x14BB04882,
0x14BB09346,
0x14BB15868,
0x14BB1CA96,
0x14BB1E48A,
0x14BB1FC5A,
0x14BB21979,
0x14BB21BDE,
0x14BB242AF,
0x14BB24927,
0x14BB2C7B0,
0x14BB30EF4,
0x14BB37799,
0x14BB3AA05,
0x14BB423B2,
0x14BB42F13,
0x14BB44F93,
0x14BB45129,
0x14BB48C26,
0x14BB4BD8D,
0x14BB4C498,
0x14BB4D00D,
0x14BB4FC00,
0x14BB50E8D,
0x14BB57FFB,
0x14BB60E63,
0x14BB64D83,
0x14BB67396,
0x14BB69F17,
0x14BB6ACCF,
0x14BB70B4D,
0x14BB714FE,
0x14BB7859D,
0x14BB82EFF,
0x14BB86019,
0x14BB88749,
0x14BB89919,
0x14BB8D7CF,
0x14BC0B6BF,
0x14BC0D671,
0x14BC34710,
0x14BC35765,
0x14BC38700,
0x14BC3941F,
0x14BC3A326,
0x14BC3B873,
0x14BC3CD6F,
0x14BC3CE22,
0x14BC3F705,
0x14BC4C130,
0x14BC4CDE6,
0x14BC54F57,
0x14BC56C46,
0x14BC5CB4A,
0x14BC656DB,
0x14BC657BA,
0x14BC68F18,
0x14BCB6BFA,
0x14BCBC601,
0x14BCBCBCA,
0x14BCBD596,
0x14BCC86C1,
0x14BCCC17D,
0x14BCD2059,
0x14BCD6A36,
0x14BCD9291,
0x14BCDDFD8,
0x14BCE5FC2,
0x14BCE7E55,
0x14BCE8BE4,
0x14BCE9ACF,
0x14BCF105A,
0x14BCF12D1,
0x14BCFA39E,
0x14BCFAEB5,
0x14BCFB339,
0x14BCFB394,
0x14BD04A53,
0x14BD0C09B,
0x14BD0F968,
0x14BD7184A,
0x14BDB8CD4,
0x14BDBB690,
0x14BDBC17B,
0x14BDC1732,
0x14BDC27BF,
0x14BDC3213,
0x14BDC3A6A,
0x14BDD1829,
0x14BDD3732,
0x14BDD9F03,
0x14BDDA3E0,
0x14BDDD6C6,
0x14BDE6A8D,
0x14BDE7DD3,
0x14BDE92BA,
0x14BDEA25C,
0x14BDF0034,
0x14BDFAEED,
0x14BDFC26C,
0x14BE00996,
0x14BE00F6C,
0x14BE02A7C,
0x14BE083B2,
0x14BE11768,
0x14BE18E54,
0x14BE1F482,
0x14BE21D97,
0x14BE3098D,
0x14BE5EB08,
0x14BE64E8C,
0x14BE65AF8,
0x14BE68B8D,
0x14BE6EB30,
0x14BE7045A,
0x14BE7433D,
0x14BE7AF38,
0x14BE7F377,
0x14BE89D93,
0x14BE9BC71,
0x14BE9E2B4,
0x14BEA5374,
0x14BEA6F65,
0x14BEAE8B0,
0x14BEB8C2A,
0x14BEB9450,
0x14BEC31BD,
0x14BEC58BE,
0x14BECAC7E,
0x14BED17B6,
0x14BED1BFB,
0x14BED54A0,
0x14BEDBC7B,
0x14BEE5679,
0x14BEE9824,
0x14BEEAA42,
0x14BEEACC5,
0x14BEEC39B,
0x14BEEC3E0,
0x14BEF214D,
0x14BEF5CEC,
0x14BF000AB,
0x14BF08BE3,
0x14BF19973,
0x14BF19BA9,
0x14BF2A59B,
0x14BF2F52A,
0x14BF30011,
0x14BF32866,
0x14BF35803,
0x14BF39362,
0x14BF3F92F,
0x14BF438DD,
0x14BF43DB9,
0x14BF49549,
0x14BF4BB7C,
0x14BF4C8A8,
0x14BF5287A,
0x14BF5A0A4,
0x14BF5B25B,
0x14BF5EF0E,
0x14BF73CDB,
0x14BF784AA,
0x14BF7C581,
0x14BF7DB1A,
0x14BF82743,
0x14BF84963,
0x14BF8B19D,
0x14BF8D2CF,
0x14BF91994,
0x14BF950CE,
0x14BFA5FA8,
0x14BFA68E6,
0x14BFB30E3,
0x14BFB4F69,
0x14BFB553D,
0x14BFB840E,
0x14BFB9D7E,
0x14BFBEB33,
0x14BFC5E0B,
0x14BFC6017,
0x14BFC70DE,
0x14BFC8FE9,
0x14BFD4EDD,
0x14BFD8230,
0x14BFDCEE5,
0x14BFDE795,
0x14BFDEB06,
0x14BFDF4FE,
0x14C006DA8,
0x14C00990A,
0x14C016FA5,
0x14C01980C,
0x14C0698CB,
0x14C071FFA,
0x14C078EC8,
0x14C07BBC7,
0x14C07D3EB,
0x14C07E695,
0x14C081960,
0x14C089ED2,
0x14C09F709,
0x14C0A80E7,
0x14C0AA53F,
0x14C0AB4AC,
0x14C0AE170,
0x14C0AEB55,
0x14C0B0093,
0x14C0B09AC,
0x14C0BB106,
0x14C0BE1CC,
0x14C0C5EE4,
0x14C0C63E8,
0x14C0D2894,
0x14C0D85DD,
0x14C0D926E,
0x14C0E82C0,
0x14C0EDDD2,
0x14C0F7CB3,
0x14C0F934E,
0x14C0FA838,
0x14C0FAF00,
0x14C0FD876,
0x14C101924,
0x14C104713,
0x14C1051C2,
0x14C1074D9,
0x14C10863A,
0x14C10A51B,
0x14C11092F,
0x14C170C7A,
0x14C1737F8,
0x14C17A37B,
0x14C18332C,
0x14C1E0E9E,
0x14C1E2A39,
0x14C1E3E7C,
0x14C1E67C0,
0x14C1E9AA8,
0x14C1EBA01,
0x14C1EE31F,
0x14C1F18E4,
0x14C1F3B80,
0x14C1F5E6E,
0x14C1F5F75,
0x14C1FAE4D,
0x14C1FC26A,
0x14C1FC625,
0x14C1FD553,
0x14C200AE5,
0x14C202042,
0x14C20701C,
0x14C20E0CF,
0x14C20F131,
0x14C231030,
0x14C23C17C,
0x14C23E7D8,
0x14C23FBBD,
0x14C2415E9,
0x14C2440CC,
0x14C24AFA0,
0x14C24B0B1,
0x14C24B99B,
0x14C250711,
0x14C252ACF,
0x14C25C0D5,
0x14C265061,
0x14C26A289,
0x14C27695B,
0x14C277EBA,
0x14C27B2F5,
0x14C27B803,
};