| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 639 人关注过本帖
标题:[求助]关于ReadProcessMemory函数的,,问题。。。请进
只看楼主 加入收藏
miker99
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-9-13
收藏
 问题点数:0 回复次数:0 
[求助]关于ReadProcessMemory函数的,,问题。。。请进
目的:从内存中读出一个整数型数值。
问题:在单步跟踪的时候,该函数的第二个参数,总是一个地址。也读不出来任何数据,
代码如下:
Sub SearchMem(Hwndle As Long, bSearch As Long)
Const PAGE_READWRITE = 4, MEM_COMMIT = &H1000
Dim r As Long, mbi As MEMORY_BASIC_INFORMATION
Dim lpAddress As Long: lpAddress = &H400000 '以 400000 作为起点
Dim nCount As Long

nCount = 0
r = VirtualQuery(lpAddress, mbi, Len(mbi)) '这里只能用VirtulQuery(),而用VirtualQueryEx()返回零

'将7F000000作为搜索结束地址
Do While (r And (lpAddress < &H7F000000))

'只搜索可读取的已提交的内存区域
If (mbi.Protect And PAGE_READWRITE) And (mbi.State = MEM_COMMIT) Then

Dim lpBuffer(40) As Byte
Dim lenth_NUMBER As Integer
ReadProcessMemory Hwndle, mbi.BaseAddress, lpBuffer(0), mbi.RegionSize, lenth_NUMBER

List1.AddItem (mbi.BaseAddress) '将查询地址输出
List2.AddItem (lpBuffer) '将查询到的值输出


' If lpBuffer = bSearch Then '判断。与要查找的值是否相同
' Text1.Text = lpBuffer
' Text1.Text = Text1.Text & " " & mbi.BaseAddress
' nCount = nCount + 1
' End If
'
' If lpBuffer = bSearch Then '判断。与要查找的值是否相同
' Text2.Text = lpBuffer
' Text2.Text = Text2.Text & " " & mbi.BaseAddress
' nCount = nCount + 1
' End If

End If
lpAddress = lpAddress + mbi.RegionSize
r = VirtualQuery(lpAddress, mbi, Len(mbi))
Loop

If nCount = 0 Then
MsgBox "搜索不到任何结果", vbExclamation
Else
MsgBox "此次共搜索到 " & nCount & " 个结果", vbInformation
End If
End Sub

帮我看下为什么??谢谢。。。
搜索更多相关主题的帖子: 函数 
2007-03-13 22:56
快速回复:[求助]关于ReadProcessMemory函数的,,问题。。。请进
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021526 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved