Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than kernel32, prefix the name with the module name and a period.
<DllImport("kernel32.dll", CharSet:=CharSet.Auto)> _
Friend Function Toolhelp32ReadProcessMemory(ByVal th32ProcessID As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal cbRead As Integer, ByRef lpNumberOfBytesRead As Integer) As Integer
End Function
<DllImport("kernel32.dll", CharSet:=CharSet.Ansi)> _
Friend Function Toolhelp32ReadProcessMemory(ByVal th32ProcessID As Integer, ByVal lpBaseAddress As Integer, <Out()> ByVal lpBuffer As Text.StringBuilder, ByVal cbRead As Integer, ByRef lpNumberOfBytesRead As Integer) As Integer
End Function
User-Defined Types:
None.
Notes:
In VB.NET, the 'CharSet' field of the 'DllImport' attribute needed to be set to 'Ansi' instead of 'Auto', and 'lpBuffer' should be defined as 'System.Text.StringBuilder' instead of 'Byte()' when returning a string.
Tips & Tricks:
Please add some!
Sample Code:
Private Function GetControlProgID(ByVal iProcessID As Integer, ByVal iBaseAddress As Integer, ByVal iBlkSize As Integer) As String
Dim iInfoPtr As Integer, iStrPtr As Integer
Dim sWork As New Text.StringBuilder(iBlkSize)
Try
Toolhelp32ReadProcessMemory(iProcessID, iBaseAddress + 44, iInfoPtr, 4, 0) ' Get pointer to class info...
Toolhelp32ReadProcessMemory(iProcessID, iInfoPtr + 36, iStrPtr, 4, 0) ' Get pointer to Control Class string...
If iStrPtr <> 0 Then Toolhelp32ReadProcessMemory(iProcessID, iStrPtr, sWork, iBlkSize, 0)
If (sWork.ToString & " ").Substring(0, 2) <> "VB" Then
Return ""
Else
Return sWork.ToString
End If
Catch ex As Exception
Return ""
End Try
End Function
Alternative Managed API:
Do you know one? Please contribute it!
The Toolhelp32ReadProcessMemory API
3/16/2007 7:58:38 AM - -67.99.249.7
Click to read this page
4/6/2008 7:23:14 AM - anonymous
TODO - a short description
3/16/2007 8:02:38 AM - -89.49.254.174
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).