請問各位大大 我執行寵物技能按鍵 記憶體位子錯 請問 哪一個偏移錯誤了?
感恩 下面是call 碼:
const
call_BbPTGJ = $511A70; //宠物攻击
call_BbGJPush = $96CF3C; //宠物攻击压栈
call_BbJiLeng = $5C9300; //宠物技能
e_GameBase = $A5B90C; //全局基址
e_OneBaseOffset = $1C; //一级基址
e_UserOffset = $20; //人物基址
e_CongWu = $100C; //宠物信息
e_SelGW = $11c; //选中怪偏移
procedure BbAttackA(P:PParams4); stdcall;
var
Addr1, Addr2, Addr3: Pointer;
key: DWORD;
begin
Addr1 := Pointer(call_BbJiLeng);
Addr2 := Pointer(call_BbPTGJ);
Addr3 := Pointer(call_BbGJPush);
key := p.Param9;
asm
pushad
mov edx, dword ptr[key]
cmp edx, 0
je @OnExit
cmp edx, 1
je @a1
jmp @a2
@a1: //普通攻击 //Alt + 1
mov eax, dword ptr[e_GameBase]
mov ecx, dword ptr[eax + e_OneBaseOffset]
mov eax, dword ptr[ecx + $4]
mov ecx, dword ptr[eax + $8]
mov edx, [ecx]
mov eax, dword ptr[ecx + $60]
mov edi, edx
mov ecx, dword ptr[eax + edx * 4]
push addr3
call addr2
jmp @OnExit
@a2: //技能攻击
mov eax, dword ptr[e_GameBase]
mov ecx, dword ptr[eax + e_OneBaseOffset]
mov eax, dword ptr[ecx + e_UserOffset]
mov ebx, dword ptr[eax + e_SelGW] //选中怪ID
mov ecx, dword ptr[eax + e_CongWu] //宠物信息基址
mov edi, dword ptr[ecx + $8] //当前宠物在背包中的位置
mov eax, dword ptr[ecx + edi * 4 + $10] //当前宠物基址
sub edx, 2
cmp edx, 0 //Alt + 2
je @alt5
cmp edx, 1 //Alt + 3
je @alt4
cmp edx, 2 //Alt + 4
je @alt3
cmp edx, 3 //Alt + 5
je @alt2
@alt2:
add eax, $30
jmp @alt5
@alt3:
add eax, $20
jmp @alt5
@alt4:
add eax, $10
jmp @alt5
@alt5:
add eax, $3c
mov ecx, eax //得到技能ID
mov eax, ecx
push 5 //压入5
push eax //技能ID
push 4 //压入4
mov edx, ebx
push ebx //目标ID
call Addr1
add esp, $10
//add esp, $c
@OnExit:
popad
end;
end;
procedure TForm1.mBbAttack(key: DWORD)stdcall;
var
MyParam:PParams4;
ParamSum:DWORD;
begin
MyParam.Param9 := key;
ParamSum := sizeof(MyParam);
if hCurrentHandle <> 0 then
begin
InjectFunc2(hCurrentWindow,@BbAttackA, @MyParam, ParamSum);
end;
end; |