我是一个新手,现在遇到一个问题,请各位高手帮忙。。。谢谢!!!(100分)

  • 主题发起人 主题发起人 蜡笔小小新
  • 开始时间 开始时间

蜡笔小小新

Unregistered / Unconfirmed
GUEST, unregistred user!
我通过硬件采集器把数据采集到内存指定的地址中,我如何把内存地址中的数据读出来???
 
是在win98下还是win2000下?采集器内存是双口ram吗?
 
win98下,是双口ram。
 
那就很简单,用delphi的ptr函数就可以,Ptr(ram地址);<br><br>要注意内存地址要转换为5位的表示。例如显存地址$A0000000就要写成$A0000<br><br>下面是直接写显存的例子<br><br>var<br>&nbsp; P: ^Byte;<br>&nbsp; I: Integer;<br>begin<br>&nbsp; P:=Ptr($A0000);<br>&nbsp; for I:=1 to 10000 do<br>&nbsp; begin<br>&nbsp; &nbsp; P^:=0;<br>&nbsp; &nbsp; Inc(P);<br>&nbsp; end;<br>end;<br>
 
那如果要不是双口ram,该怎么办?谢谢!!!
 
不是双口ram也可以,显存也不是双口ram呀。
 
不好意思。我是个新手不太懂,请问如何直接读写内存呢/
 
你是要访问物理内存,还是虚拟内存呢?硬件采集器提供的内存地址都是物理地址,我给<br>你的例子也是访问物理地址的,你的采集器提供的地址是多少?
 
我这有一段vb的程序你看看,<br>Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long<br>Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long<br><br><br>Function DoFirstSearch(s As String) As Integer<br><br>Dim c As Integer<br>Dim addr As Long<br>Dim buffer As String * 5000<br>Dim readlen As Long<br>Dim strHex As String<br><br>Open "c:/cheat.mem" For Output As #1: Close #1 ' kill if exists<br>Open "c:/cheat.mem" For Random As #1 Len = Len(addr)<br><br>'count of results<br>c = 0<br><br>For addr = 0 To 65535 &nbsp; &nbsp;' loop through buffers<br><br>Call ReadProcessMemory(myHandle, addr * 5000, buffer, 5000, readlen)<br><br>If addr Mod 656 = 0 Then<br>'update status<br>&nbsp; frmMain.lblStatus.Caption = "Searching %" &amp; Trim(Str(Int(addr / 400)))<br>&nbsp; DoEvents<br>End If<br><br>'if read successfull<br>If readlen &gt; 0 Then<br>&nbsp; startpos = 1<br>&nbsp; 'find all search string in buffer<br>&nbsp; While InStr(startpos, buffer, Trim(s)) &gt; 0<br>&nbsp; &nbsp; p = (addr) * 5000 + InStr(startpos, buffer, s) - 1 ' position of string<br>&nbsp; &nbsp; Debug.Print addr<br>&nbsp; &nbsp; Debug.Print p<br>&nbsp; &nbsp; Debug.Print buffer<br>&nbsp; &nbsp; strHex = Hex$(p)<br>&nbsp; &nbsp; Put #1, , CLng(p) &nbsp;' put address in file for later searches<br>&nbsp; &nbsp; c = c + 1 ' increase counter<br>&nbsp; &nbsp; If c &lt; 20 Then frmMain.lstResults.AddItem Format(strHex, "00000000")<br>&nbsp; &nbsp; startpos = InStr(startpos, buffer, Trim(s)) + 1 ' find next position<br>&nbsp; Wend<br>End If<br><br>'next buffer<br>Next addr<br><br>'Update status<br>&nbsp; frmMain.lblStatus.Caption = "Search Done."<br><br>'close file<br>Close #1<br><br>DoFirstSearch = c<br><br>End Function<br><br><br><br>Function InitProcessCheater(pid As Long)<br><br>pHandle = OpenProcess(&amp;H1F0FFF, False, pid)<br><br>If (pHandle = 0) Then<br>&nbsp; &nbsp; InitProcessCheater = False<br>&nbsp; &nbsp; myHandle = 0<br>Else<br>&nbsp; &nbsp; InitProcessCheater = True<br>&nbsp; &nbsp; myHandle = pHandle<br>End If<br><br>End Function<br><br><br>我的程序中的部分代码。<br>
 
读写指定进程内存的程序,你叫我看什么?
 
接受答案了.
 
后退
顶部