In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to solve the problem of ReadProcessMemory in VB.NET. It is very detailed and has a certain reference value. Friends who are interested must finish it!
In the course of VB.NET at school, VB had learned a little bit before and could only read and not write, but there was no way. The school opened it, so a few people formed a group to write an antivirus software under VB.NET. They wanted to use VB.NET ReadProcessMemory to read the memory of other processes. No matter how they could be called, goole and baidu looked for N hours. There are a lot of people who have raised this problem, but no one has solved it, but it also gives me some. In fact, with the help of my friend freecat, I found out where the problem lies, mainly the problem stated by VB.NET ReadProcessMemory. We should declare this.
Public Declare Function ReadProcessMemory Lib "kernel32"
(ByVal hProcess As Integer, ByVal lpBaseAddress As Integer
ByVal lpBuffer () As Byte, ByVal nSize As Integer
ByRef lpNumberOfBytesWritten As Integer) As Integer
The main one, ByVal lpBaseAddress As Integer, ByVal lpBuffer () As Byte, should be set to byval instead of byref, so that the call can get the return value.
Private Declare Function OpenProcess Lib "kernel32.dll" _
(ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Integer
ByVal dwProcessId As Integer) As Integer
Public Declare Function ReadProcessMemory Lib "kernel32"
(ByVal hProcess As Integer, ByVal lpBaseAddress As Integer
ByVal lpBuffer () As Byte, ByVal nSize As Integer
ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Const PROCESS_VM_READ As Long = & H10
Dim ph As Integer
Dim i As Integer
Dim h As Integer
Dim buffer (20) As Byte
Dim bytesRead As Integer
'get the process
Ph = OpenProcess (PROCESS_ALL_ACCESS, False, 1832)
If ph Then
MessageBox.Show ("true")
H = ReadProcessMemory (ph, & H403000, buffer, buffer.Length, bytesRead)
For I = 0 To buffer.Length-1
TempMem + = buffer (I) .ToString
Next
Else
MessageBox.Show ("false")
End If
The above is all the contents of the article "how to solve the problem of ReadProcessMemory in VB.NET". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.