[Help]Read address

Posts 1–11 of 11 · Page 1 of 1
[Help]Read address
Hi I have a problem with reading a memory address.
Well the problem is that I have no idear how to do it.
I want to be able to specify a address and then display its value on a label or what ever.
i asked this a while ago...
I can't get it to work because it always returns 0.
I have a button and a label.
Code:
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Code:
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click

        Dim Health As Integer = &H1A4B159
        Dim displayHealth As Integer
        Dim proc As Process = Process.GetCurrentProcess
        For Each proc In Process.GetProcesses
            If proc.MainWindowTitle = "BlackOps" Then
                ReadProcessMemory(proc.Handle.ToInt32(), Health, displayHealth, 4, 0)

            End If
        Next
        Label14.Text = (displayHealth)

    End Sub
I don't know if I did the dim proc part right but I'm pretty sure that the rest is correct.
Is this right:
Code:
If proc.MainWindowTitle = "BlackOps" Then
That is the process name, but is it supposed to be the window name:
Code:
If proc.MainWindowTitle = "Call of Duty©: BlackOps" Then
Like that?

Quote Originally Posted by *****179 View Post
i asked this a while ago...
Did you get an answer?
You have give yourself permission to read/write. Look up OpenProcess()
I still get a 0 in label14
Code:
    Private Declare Function OpenProcess Lib "kernel32.dll" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
    Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Single, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
    Dim RBuff1 As Long
Code:
    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX16.Click
        Dim BlackOpsLookUp As Process() = Process.GetProcessesByName("BlackOps")

        Dim processHandle As IntPtr = OpenProcess(&H1F0FFF, 0, BlackOpsLookUp(0).Id)

        ReadProcessMemory(processHandle, &H1A4B15C, RBuff1, 4, Nothing)
        Label14.Text = (RBuff1)
    End Sub
Edit:
I tried changing it to this, but it still doesn't work.
Code:
        Dim processHandle As IntPtr = OpenProcess(&H10, 0, BlackOpsLookUp(0).Id)
Are you trying to read memory while debugging your program? Because if you are you wont be able to open a handle to another process. Which would result in not being able to read.
Quote Originally Posted by wtfiwantthatname View Post
Are you trying to read memory while debugging your program? Because if you are you wont be able to open a handle to another process. Which would result in not being able to read.
I will try building the program.

Quote Originally Posted by wtfiwantthatname View Post
Are you trying to read memory while debugging your program? Because if you are you wont be able to open a handle to another process. Which would result in not being able to read.
Building it didnt change anything.
I still get a 0.
Double Post Removed, Merged comments.
Just use Blubbs awesome DLL.
Search for it...
btw i think you can only read integer.
Posts 1–11 of 11 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us