枫
枫间残月
Unregistered / Unconfirmed
GUEST, unregistred user!
要的人这么多,我还是贴出来吧,首先是取得程序的PID<br>public<br> hSnapshot,HDProcess: THandle;<br> sFileName,f,pill: string;<br> iProcessID: Integer;<br> x,y:integer;<br> iOK:Boolean;<br> nSize,lpNumberOfBytesReadWORD;<br> s:byte;<br> pid: dword;<br> dataX,dataY:byte;<br> { Public declarations }<br> end;<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.FormCreate(Sender: TObject);<br>var<br> hw: HWND;<br>begin<br> hw := FindWindow(nil,'幻灵游侠'); //找到窗口句柄 玩一个网络游戏,(外挂)<br><br> if hw <> 0 then<br> GetWindowThreadProcessId(hw, @pid) //找出PID<br> else<br> begin<br> showmessage('没找到');<br> Exit;<br> end;<br>end;<br><br>procedure TForm1.FlatButton1Click(Sender: TObject); <br>var<br>lpBufferX,lpBufferYchar;<br>write : dword;<br>begin<br>HDProcess:=OpenProcess(PROCESS_ALL_ACCESS, False, pid ); //得到进程句柄<br>nSize:=1;<br>getmem(lpBufferX,2);<br>getmem(lpBufferY,2);<br><br>y:=$006C22AC; //这是想修改的内存地址 下面也是.<br>x:=$006C22A8;<br>lpBufferX^:=chr(dataX);<br>lpBufferY^:=chr(dataY);<br><br>WriteProcessMemory(HDProcess,Pointer(x),lpBufferX,nSize,Write); //这儿就是写入内存数据,以达到修改游戏的目的.<br>WriteProcessMemory(HDProcess,Pointer,lpBufferY,nSize,Write);<br>//写入内存数据<br>FreeMem(lpBufferX); //释放内存<br>FreeMem(lpBufferY);<br>closehandle(HDProcess); //关闭句柄<br><br>end;<br>