特征码 Pattern
特征码搜索与匹配后读内存
shared/Pattern.h · plugin::pattern
用十六进制字节串在模块里定位地址。空格分隔,? 表示通配。结果会缓存;找不到时返回 0。
"89 86 ? ? ? ? 8B 0D"用法
搜到的地址通常交给 CallDyn* 或 plugin::patch。调用前务必判断非零。
主模块搜索
Get
plugin::pattern
在主模块中搜索特征串。offset 加在匹配起始地址上(可用来跳到指令中部或相对偏移处)。
static uintptr_t Get(std::string_view const& bytes, int32_t offset = 0);指定模块搜索
GetExternal
plugin::pattern
在指定模块映像中搜索,例如外部 DLL。
static uintptr_t GetExternal(void* module, std::string_view const& bytes, int32_t offset = 0);匹配后读内存
Read / ReadExternal
plugin::pattern
先按特征定位,再从 offset 处按类型读取(常见:读绝对地址 / 函数指针)。
template <typename T = void*>
static auto Read(std::string_view const& bytes, int32_t offset = 0);
template <typename T = void*>
static auto ReadExternal(void* module, std::string_view const& bytes, int32_t offset = 0);宏简写
gpattern / gpatternt
宏
常用简写:gpattern 等价 Get(..., 0);gpatternt 等价 Read。
#define gpattern(bytes) plugin::pattern::Get(bytes, 0)
#define gpatternt(t, bytes, offset) plugin::pattern::Read<t>(bytes, offset)