没有合适的资源?快使用搜索试试~ 我知道了~
按照8字节搜索指定PID某范围内的所有地址的软件源码
需积分: 9 1 下载量 70 浏览量
2011-04-09
19:26:45
上传
评论
收藏 2KB TXT 举报
温馨提示
试读
2页
按照8字节搜索指定PID某范围内的所有地址这个是很经典的例子,大家做软件可能用到,欢迎下载
资源推荐
资源详情
资源评论
Option Explicit
'===================================================================================
'功能:按照8字节搜索指定PID某范围内的所有地址
'用法:Call FindMem64(4523,&H515C0020,&H30303251) '20005C5151323030
'===================================================================================
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function ReadProcessMemoryByAddr Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByVal lpBuffer As Long, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Public Sub FindMem64(ByVal pid As Long, ByVal dwHigh As Long, ByVal dwLow As Long)
Const STEPLEN = &H1000
Dim i As Long, j As Long
Dim dwRead As Long
Dim data4 As Long
Dim byData(-8 To STEPLEN) As Byte
Dim hProcess As Long
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If hProcess = 0 Then Exit Sub
For i = &H0 To &HFFFFFFF - STEPLEN Step STEPLEN
CopyMemory byData(-8), byData(STEPLEN), 8
If ReadProcessMemoryByAddr(hProcess, i, VarPtr(byData(0)), STEPLEN, dwRead) <> 0 And dwRead = STEPLEN Then
For j = -7 To STEPLEN - 8
CopyMemory data4, byData(j), 4
If data4 = dwHigh Then
CopyMemory data4, byData(j + 4), 4
If data4 = dwLow Then
Debug.Print i + j
End If
End If
Next
'===================================================================================
'功能:按照8字节搜索指定PID某范围内的所有地址
'用法:Call FindMem64(4523,&H515C0020,&H30303251) '20005C5151323030
'===================================================================================
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function ReadProcessMemoryByAddr Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByVal lpBuffer As Long, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Public Sub FindMem64(ByVal pid As Long, ByVal dwHigh As Long, ByVal dwLow As Long)
Const STEPLEN = &H1000
Dim i As Long, j As Long
Dim dwRead As Long
Dim data4 As Long
Dim byData(-8 To STEPLEN) As Byte
Dim hProcess As Long
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If hProcess = 0 Then Exit Sub
For i = &H0 To &HFFFFFFF - STEPLEN Step STEPLEN
CopyMemory byData(-8), byData(STEPLEN), 8
If ReadProcessMemoryByAddr(hProcess, i, VarPtr(byData(0)), STEPLEN, dwRead) <> 0 And dwRead = STEPLEN Then
For j = -7 To STEPLEN - 8
CopyMemory data4, byData(j), 4
If data4 = dwHigh Then
CopyMemory data4, byData(j + 4), 4
If data4 = dwLow Then
Debug.Print i + j
End If
End If
Next
资源评论
skccsoft
- 粉丝: 1
- 资源: 73
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功