0

I am using Cheat Engine to get addresses to edit something in the application. But it seems like I'm doing it wrong when putting the values in Visual Studio using Read/WriteProcessMemory and Visual Basic.

Image

Here is the values I got in Cheat Engine. Now how can I translate these information and use ReadProcessMemory to get the value?

Here is my code which isn't working and giving different value:

    Dim hp = OpenProcess(2035711, 0, ComboBox1.SelectedItem)
    Dim Pointer = 0
    ReadProcessMemory(hp, 22724000, Pointer, 4, 0)
    Dim Address As Integer = Pointer + Convert.ToInt32("784B2", 16)

    Dim value As Integer = 0
    ReadProcessMemory(hp, Address, value, 4, Nothing)
    MsgBox(value)
Keanu Lorenzo
  • 79
  • 1
  • 14
  • 1
    First, you can express your number in hex, so you won't need to convert the string. Thus you can use `Address = Pointer + &H784B2`. As to the problem, it seems that your address is wrong. It seems like it should be: `Dim Address As Integer = &H21EF80 + &H784B2`. That is, the base address (&H21EF80) plus the offset (&H784B2). Are you sure the base address is correct? – Chris Dunaway Nov 16 '16 at 14:33
  • @ChrisDunaway I'm not sure if it's correct but I'll explore and try to learn on how to do stuff... But thank you for the information. Atleast I know something about CE now. :D – Keanu Lorenzo Nov 17 '16 at 11:00
  • @ChrisDunaway I'm not sure if the address is correct(with the pointer added to it) because it does not give the correct values and just 0. The value that I am expecting is 1. How to get the static pointer? I just found out that the pointer was changing and nothing(in the list of pointers in CE) gives the exact values when the game is restarted. So basically the picture attached to the question is not static. – Keanu Lorenzo Nov 17 '16 at 11:07
  • 1
    You will probably need to use `GetModuleInformation` function to get the base address after the module has been loaded. – Chris Dunaway Nov 17 '16 at 14:15
  • 1
    There is a project at Code Project that implements a basic memory scanner. It's written in C# but you should be able to get some useful code. Pay special attention to the MemoryScanner.cs file as it contains useful classes for reading memory. http://www.codeproject.com/Articles/15680/How-to-write-a-Memory-Scanner-using-C – Chris Dunaway Nov 17 '16 at 15:23

1 Answers1

0

The code works perfectly but the address I want to change was wrong. That's why I thought the code is wrong. Anyways, thank you to all of you who helped me and suggested to use Hex.

Keanu Lorenzo
  • 79
  • 1
  • 14