我想用DELPHI编写一个模拟调用游戏某项功能的函数的外挂如以下代码:
procedure DoObject(idx:LongWord);
var pPlayer:pChar;
addr:LongWord;
begin
pPlayer := pChar(pLongWord($11EAC88)^);
pLongWord($B0FF58)^ := idx;
addr := $43BC10;
asm
mov ecx,pPlayer
push 0
push $78
push 3
call addr
end;
end;
procedure DoKongFu ();cdecl;
const
addr:DWORD = $0050C11B;
begin
asm
push ebp
mov ebp,esp
sub esp,$0C94
push ebx
push esi
push edi
xor ebx,ebx
mov ecx,$2FE
xor eax,eax
lea edi,dword ptr [ebp-$C8E]
mov word ptr [ebp-$C90],bx
mov word ptr [ebp-$C92],bx
mov word ptr [ebp-$C94],bx
rep stos dword ptr [edi]
stos word ptr [edi]
mov eax,dword ptr [$1201774]
mov dword ptr [eax+$1B4],ebx
mov ecx,dword ptr [$1201774]
mov eax,dword ptr [ebp+8]
mov byte ptr [ecx+$1BC],bl
mov edx,dword ptr [$1201774]
mov dword ptr [edx+$1B8],-1
jmp addr
end;
end;
procedure UseKongFu(attr:DWORD);
var
pKongFu:pointer;
begin
pKongFu := GetKongFuPtr(attr); // 根据武功ID获取其对象指针
if pKongFu <> nil then //指针正确
begin
asm
push eax
mov eax,pKongFu //武功对象指针
push eax
call DoKongFu //调用
add esp,4
pop eax
end;
end;
end;
应该怎么写才能在游戏中实现?我曾经试过直接套用该代码,但不成功,不断的弹出错误信息框。小虾大侠能指导我一下吗?如提供一些代码给我参考吗?谢谢,非常感谢!
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)