Results 1 to 1 of 1
  1. #1
    SlayerDrum
    SlayerDrum is offline
    New member SlayerDrum's Avatar
    Join Date
    2013 Dec
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Red face Module To Read Memory String

    Hello guys, this is my first post on the VB area, hopefully it will be helpful for you

    This module is for you to display the value from memory into text (often used to gamehacking)
    My friend gave me and I gave him an edited


    Code:
    Imports System.Runtime.InteropServices 
    
    Module ReadMemoryString
        <DllImport("kernel32.dll", SetLastError:=True)> Private Function ReadProcessMemory _
    (ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByRef lpBuffer As Byte, _
     ByVal iSize As Integer, ByRef lpNumberOfBytesRead As Integer) As Boolean
        End Function
    
    
        Public Function ReadString(ByVal proces As String, ByVal address As Integer) As String
            Try
    
                Dim process0 As String = proces
    
                Dim prox As Process() = Process.GetProcessesByName(process0)
                Return GetTextinMemory(prox(0).Handle, address, 16) & GetTextinMemory(prox(0).Handle, address + 32, 16)
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Function
    
    
        Private Function GetTextinMemory(ByVal ProcessHandle As IntPtr, ByVal MemoryAddress As IntPtr, ByVal CharsToRead As Integer, Optional ByVal IsUnicode As Boolean = True) As String
            Dim ReturnValue As String = vbNullString
            Dim StringBuffer() As Byte
            If IsUnicode Then
                ReDim StringBuffer(CharsToRead * 2 - 1)
            Else
                ReDim StringBuffer(CharsToRead - 1)
            End If
            Try
                If ReadProcessMemory(ProcessHandle, MemoryAddress, StringBuffer(0), StringBuffer.Length, Nothing) Then
                    If IsUnicode Then
                        ReturnValue = System.Text.Encoding.ASCII.GetString(StringBuffer)
                    Else
                        ReturnValue = System.Text.Encoding.Default.GetString(StringBuffer)
                    End If
                End If
    
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
            Return ReturnValue
        End Function
    End Module
    Example of how to use:
    Add one Label
    In form load event add this code

    Code:
    Label1.Text = ReadString("processo", &H-Address)

Similar Threads

  1. [Help] Read string value with delphi ReadProcessMemory
    By fiqhpratama in forum Delphi
    Replies: 0
    Last Post: 2016-08-29, 11:15 AM
  2. [C#] Yet Another Simple Write / Read Memory Class
    By TheTime in forum VB, .NET Framework
    Replies: 0
    Last Post: 2012-12-07, 03:39 PM
  3. [C#] class Read/Write Memory in C#
    By bigbozz in forum Perfect World Bots, Cheats
    Replies: 0
    Last Post: 2012-12-02, 09:08 AM
  4. Replies: 0
    Last Post: 2012-07-12, 12:59 PM
  5. [C#] How to Read and Write to the Process Memory
    By Grooguz in forum VB, .NET Framework
    Replies: 0
    Last Post: 2011-11-27, 05:27 AM
Visitors found this page by searching for:
Nobody landed on this page from a search engine, yet!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •