procedure TForm1.FormCreate(Sender: TObject);
begin
MyHwnd:=findwindow(nil, 'Element Client');
GetWindowThreadProcessId(MyHwnd, @ThreadID);
hProcess_N := OpenProcess(PROCESS_ALL_ACCESS, False, ThreadID);
if hProcess_N = 0 then
begin
Messagebox(handle, '請先登入遊戲',MB_OK+MB_IconError);
exit;
end;
Base0:=$9045EC; // $12F82C
MemSize:=128;
ThreadAdd := VirtualAllocEx(hProcess_N, nil, MemSize, MEM_COMMIT, PAGE_READWRITE);<--------------這行ok
ParamAdd := VirtualAllocEx(hProcess_N, nil, 20, MEM_COMMIT, PAGE_READWRITE););<--------------這行ok
end;
procedure TForm1.FormDestroy(Sender: TObject);<-----這與vb相同的是什麼?
begin
VirtualFreeEx(hProcess_N, ThreadAdd, MemSize, MEM_RELEASE);<--這行ok
VirtualFreeEx(hProcess_N, ParamAdd, 20, MEM_RELEASE);<--這行ok
CloseHandle(hProcess_N);
end;
<-----------------這開始若用vb寫..如何改呢??--------------------->
procedure InjectFunc(Func: Pointer; Param: Pointer; ParamSize: DWORD);
var
hThread: THandle;
lpNumberOfBytes: DWORD;
begin
if hProcess_N<>0 then
begin
// ---- 寫入函數地址
WriteProcessMemory(hProcess_N, ThreadAdd, Func, MemSize, lpNumberOfBytes);
// ---- 寫入參數地址
WriteProcessMemory(hProcess_N, ParamAdd, Param, ParamSize, lpNumberOfBytes);
// ---- 創建遠程線程
hThread := CreateRemoteThread(hProcess_N, nil, 0, ThreadAdd, ParamAdd, 0, lpNumberOfBytes);
// ---- 等待線程结束
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
end;
end;
// ---- 技能 CALL
procedure MyCall8(P:PP1_STR); Stdcall;
var
Address: pointer;
P1: DWORD;
begin
Address:=Pointer($4656F0);
P1:=P^.Param1; // ---- 技能ID号
asm
pushad
push -1
push 0
push 0
push P1
mov ecx,DWORD PTR DS:[$900adc]
mov edx,DWORD PTR DS:[ecx+$1c]
mov ecx,DWORD PTR DS:[edx+$28]
call address
popad
end;
end;
// ---- 調用CALL 技能
procedure TForm1.JiNeng;
var
MyParam : P1_STR;
ParamSum: DWORD;
begin
MyParam.Param1:=JNID;
ParamSum:=SizeOf(MyParam);
if MyHwnd<>0 then
begin
injectfunc(@MyCall8, @MyParam, ParamSum);
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
JNID:=$DA;
JiNeng;
end;
<-----------------------這結束..這一段不懂怎麼改成vb-------->
有大大知道怎麼改可以告知嗎?因為不懂p語言有一些看不懂它的意思.所以無重下手改..3q |