請問大大 我執行發生錯誤 想了好久都想不出來 請大大們指點 感謝
type // ---- 定義參數指針
PParams2 = ^TParams;
TParams2 = packed record
Param3,Param4,Param5: DWORD;
end;
procedure WalkCall2(aPParams2:PParams2); Stdcall;
var
Address1:pointer;
Address2:pointer;
Address3:pointer;
x,y,z:Single;
r_POSITION1:Integer;
begin
Address1:=Pointer($469F00);
Address2:=pointer($46E090);
Address3:=pointer($46A340);
x:=aPParams2^.Param3;
y:=aPParams2^.Param4;
z:=aPParams2^.Param5;
asm
pushad
mov eax, dword ptr [W2I_BASE_ADDR]
mov eax, dword ptr [eax+$1C]
mov esi, dword ptr [eax+$20]
mov ecx, dword ptr [esi+$ff4] //Bcc+8=BD4
push 1
call Address1
mov edi, eax
lea eax, dword ptr [esp+$18]
push eax
push 0 //r_POSITION1 //0地面 1空中
mov ecx, edi
call Address2
mov ecx, dword ptr [esi+$dd4] //Bcc+8=BD4 dd4 fec
push 0
push 1
push edi
push 1
call Address3
mov eax, dword ptr [W2I_BASE_ADDR]
mov eax, dword ptr [eax+$1C]
mov eax, dword ptr [eax+$20]
mov eax, dword ptr [eax+$ff4] //Bcc+8=BD4 dd4 fec
mov eax, dword ptr [eax+$30]
mov ecx, dword ptr [eax+4]
mov eax, x
mov dword ptr[ecx+$20], eax
mov eax, z
mov dword ptr[ecx+$24], eax
mov eax, y
mov dword ptr[ecx+$28], eax
popad
end;
end;
procedure InjectFunc2(Func: Pointer; Param: Pointer; ParamSize: DWORD);
var
hThread: THandle;
lpNumberOfBytes: DWORD;
begin
if processid<>0 then
begin
// ---- 寫入函數位址
WriteProcessMemory(processid, ThreadAdd, Func, 128, lpNumberOfBytes);
// ---- 寫入參數位址
WriteProcessMemory(processid, ParamAdd2, Param, ParamSize, lpNumberOfBytes);
// ---- 建立遠端執行緒
hThread := CreateRemoteThread(processid, nil, 0, ThreadAdd2, ParamAdd2, 0, lpNumberOfBytes);
// ---- 等待執行緒結束
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
end;
end;
procedure TForm1.FormDestroy2(Sender: TObject);
begin
VirtualFreeEx(processid, ThreadAdd, MemSize, MEM_RELEASE);
VirtualFreeEx(processid, ParamAdd, 20, MEM_RELEASE);
CloseHandle(processid);
end;
procedure TForm1.WalkTo(x, y, z: single);
var
aParams2 : TParams;
aParamsSize2: DWORD;
begin
aParams2.Param3:= x;
aParams2.Param4:= y;
aParams2.Param5:= z;
aParamsSize2=SizeOf(aParams2);
if ghwnd<>0 then
begin
injectfunc2(@WalkCall2, @aParams2, aParamsSize2);
end;
end; |