cheat engine 关于 mono 的一个语法糖
cheat engine 关于 mono 的一个语法糖
此内容年代久远,谨慎参考

适用于 7.0 以上版本

基于 LUA 的常规方式:

plain{$STRICT}
[ENABLE]
{$LUA}
local defined = 'define(inject,0)';
if syntaxcheck then return defined end;
if LaunchMonoDataCollector() == 0 then return defined end;
local classId = mono_findClass('theNamespace','theClass');
if classId == 0 then return defined end;
local methodId = mono_class_findMethod(classId,'theMethod');
if methodId == 0 then return defined end;
local addressId = mono_compile_method(methodId);
if addressId == 0 then return defined end;
return string.format('define(inject,%x)',addressId);
{$ASM}
assert(inject+AA,90 90)
registersymbol(inject)

inject+AA:
  mov eax,ebx

[DISABLE]
inject+AA:
  nop 2

unregistersymbol(*)

语法糖方式:

plain{$STRICT}
[ENABLE]
usemono()
findmonomethod(inject,theNamespace:theClass:theMethod)
assert(inject+AA,90 90)
registersymbol(inject)

inject+AA:
  mov eax,ebx

[DISABLE]
inject+AA:
  nop 2

unregistersymbol(*)

usemono 是 LUA 方法 monoAA_USEMONO 的自动汇编别名,findmonomethod 则是 LUA 方法 monoAA_FINDMONOMETHOD 的自动汇编别名,做的事情是一样的,但可以让自动汇编脚本更简洁清晰。

作者
ragnaroks
发布时间
2022-04-17
创作协议