1
16cy
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm2.Button8Click(Sender: TObject);<br>var<br>vq,paddr:longword;<br>address:longword;<br>xyByte;<br>nsize:longword;<br>x,y:integer;<br>meminfo:_MEMORY_BASIC_INFORMATION;<br>Number: longword;<br>i,j,k:integer;<br>token:cardinal;<br>begin<br>i:=0;<br>paddr:=1024;<br>nsize:=4;<br>xy:=AllocMem(nSize);<br>getwindowthreadprocessid(hnd,@Pid);//获得游戏相对应的进程的句柄<br>openprocess(PROCESS_ALL_ACCESS,false,pid);//获得进程控制权<br>//OpenProcessToken(pid,TOKEN_ADJUST_PRIVILEGES,token);//获得进程句柄的令牌环句柄<br>//AdjustTokenPrivileges(token,TRUE,ae,0,NULL,null); //修改权限<br>//扫描内存<br>vq:=VirtualQueryEx(pid,@paddr,meminfo,sizeof(meminfo));<br>[green]address:=meminfo.BaseAddress;[/green]<br>form2.Label9.Caption :=inttostr(address);<br>k:=meminfo.RegionSize div 2*nsize;<br>while vq=sizeof(meminfo) do<br>begin<br> if meminfo.state=MEM_COMMIT then<br> begin<br> for j := 0 to k do<br> begin<br> ReadProcessMemory(pid,pointer(address),xy,nsize,Number);<br> x:=xy^;<br> address:=address+nsize;<br> ReadProcessMemory(pid,pointer(address),xy,nsize,Number);<br> y:=xy^;<br> address:=address+nsize;<br> //如果x,y值等于100,100,就得到x,y坐标的地址<br> if x=100 then<br> if y=100 then<br> begin<br> XYaddress:=address-2*nsize;<br> break;<br> end;<br> end;<br> vq:=VirtualQueryEx(pid,@paddr,meminfo,sizeof(meminfo));<br> i:=i+1;<br> end<br> else <br> begin<br> paddr:=paddr+ meminfo.RegionSize;<br> vq:=VirtualQueryEx(pid,@paddr,meminfo,sizeof(meminfo));<br> end;<br> if i=9 then break;<br> <br>end;<br>freemem(xy);<br>closehandle(pid);<br>end;<br><br>绿色的那段不知道如何转换。老是通不过编译,有没有高手帮我分析一下啊,我急啊!!!!55555555555555555555555<br>address:=meminfo.BaseAddress;<br>address定义为longword类型,meminfo.baseaddress是pointer类型。如何转换?<br>我把这句写成:<br>address:=dword(meminfo.baseaddress);<br>会提示:external exception c0000008 的错误<br>访问内存地址冲突 <br>有没有高手给我指点一下迷津啊?