关于内存读取后的问题[已给出程序,大家帮忙看一下] ( 积分: 20 )

  • 主题发起人 主题发起人 weserver
  • 开始时间 开始时间
for i:=$013609A0 to $013609A0 do<br>这是干什么?放在这里又用吗?<br>你不就是要将那个Dword读到 u 中,需要用copymemory(@u,Ptr($013609A0),4);这个吗?<br> ReadProcessMemory(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProcessHndle,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pointer(i),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpBuffer,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nSize,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpNumberOfBytesRead<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;);<br><br> &nbsp; &nbsp;copymemory(@u,Ptr($013609A0),4);<br>这两句要干的是一件事,第一句是合法的,第二句是非法的。谁规定一定要申请4个字节的内存来使用 ReadProcessMemory 函数,当你声明 u 时,不是已经为 u 分配内存了,整个一个概念不清,将 u 直接放到 ReadProcessMemory 中不就完了。<br>看来这段程序是从那里抄来的,前面的 ReadProcessMemory 是原版,因为你没有理解,后面自己又加上一句 copymemory 。典型的画蛇添足。
 
u: DWORD;<br>...<br> &nbsp; &nbsp;ReadProcessMemory(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ProcessHndle,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Pointer(i),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; u,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nSize,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpNumberOfBytesRead<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;);<br>显示错误,请帮忙,谢谢
 
gzgzlxg说的有道理,你是要读别人的程序地址数据,因此要使用ReadProcessMemory,躯体的方法要看看API的说明,MSDN上有,其实API是不难使用的,难的是做API,所以不要怕,自己看看.[:)]
 
已经顺利解决问题,谢谢各位大哥,麻烦大家了,再次谢谢了!
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部