一个非常困扰我的问题,大牛进来看看
这段代码是我在网上找的。
读取到得内存数据好像和真实的不太一样呀。
是哪里错了呢。
Private Sub cmdRead_Click()
Dim pid As Long, hProc As Long
pid = getProcessId(txtExeName)
labPid.Caption = "进程编号:" & pid
hProc = OpenProcess(pid)
labHProc.Caption = "进程句柄:" & hProc
Dim buff() As Byte, ret As Boolean
ret = ReadProcessMemory(hProc, Val(txtAddr), buff, Val(txtLen))
Print buff
'ret = ReadProcessMemory(hProc, ByVal buff + &H4F0, buff, Val(txtLen))
If ret Then
' txtRet = ByteArrayToString(buff)
Dim i As Long
For i = 0 To UBound(buff)
txtRet.Text = txtRet.Text + " " + Right("00" + Hex(buff(i)), 2)
Next
Else
MsgBox "读取失败"
End If
CloseHandle pid
CloseHandle hProc
End Sub