Results 1 to 6 of 6
  1. #1
    freitag's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    ----
    Posts
    3
    Reputation
    10
    Thanks
    0

    [vb6] How do i read a float from memory(pointer+offset)+how to use multilevelpointer

    Heyho,

    I can't figure out how to read correctly some floats from memory and as this isn't enough i have no clue how to use multi level pointers

    if i do it the easy way with reading floats from a pointer i do
    newadress = adress+offset
    readprocessmem "mygame", newadress, result, 4&, 0&
    but then i get a value like 1,11xxxxx-EE instead of my player location which looks like 813,12312411512xxxx just as an example.




    multilevelpointers:
    i got this one from CE:

    base: 0x2097ba4
    offset1: 0x4a4
    offset2: 0x120


    and what should i do if i need to combine both things, i mean when i need to read a float from a multilevel pointer? adress+offset1+offset2+... isn't the right way i guess.

    i hope someone could help me.

    this is the code i use atm:
    Code:
    'module
    
    Option Explicit
    
    Public Const PROCESS_ALL_ACCESS = &H1F0FFF
    Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal SomeValueIsStoredHere As Long, lpdwProcessId As Long) As Long
    Public Declare Function OpenProcess Lib "KERNEL32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
    Public Declare Function CloseHandle Lib "KERNEL32" (ByVal hObject As Long) As Long
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal windowname As String) As Long
    Public Declare Function ReadProcessMem Lib "KERNEL32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
    Public Declare Function WriteProcessMemory Lib "KERNEL32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
    
    Global ProcessHandle As Long
    Global WindowHandle As Long
    
    
    ' $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    ' $$$ Read_DMA_Address |Pointer & Offset| $$$
    ' $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    
    Public Function Read_DMA_Byte(Address As Long, Offset As Long) As Byte
    Dim ProcessId As Long
        WindowHandle = FindWindow(vbNullString, "Age of Conan")
        If (WindowHandle = 0) Then
            MsgBox "We got no WindowHandle"
            Exit Function
        End If
    
        GetWindowThreadProcessId WindowHandle, ProcessId
        ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId)
        If (ProcessHandle = 0) Then
            MsgBox "We got no ProcessHandle"
            Exit Function
        End If
        
    ReadProcessMem ProcessHandle, Address + Offset, Read_DMA_Byte, 1&, 0&
    CloseHandle ProcessHandle
    
    End Function
    
    Public Function Read_DMA_Integer(Address As Long, Offset As Long) As Integer
    Dim ProcessId As Long
        WindowHandle = FindWindow(vbNullString, "Age of Conan")
        If (WindowHandle = 0) Then
            MsgBox "We got no WindowHandle"
            Exit Function
        End If
    
        GetWindowThreadProcessId WindowHandle, ProcessId
        ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId)
        If (ProcessHandle = 0) Then
            MsgBox "We got no ProcessHandle"
            Exit Function
        End If
        
    ReadProcessMem ProcessHandle, Address + Offset, Read_DMA_Integer, 2&, 0&
    CloseHandle ProcessHandle
    
    End Function
    
    Public Function Read_DMA_Long(Address As Long, Offset As Long, Optional offset2 As Long, Optional offset3 As Long) As Long
    Dim ProcessId As Long
        WindowHandle = FindWindow(vbNullString, "Age of Conan")
        If (WindowHandle = 0) Then
            MsgBox "We got no WindowHandle"
            Exit Function
        End If
    
        GetWindowThreadProcessId WindowHandle, ProcessId
        ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId)
        If (ProcessHandle = 0) Then
            MsgBox "We got no ProcessHandle"
            Exit Function
        End If
        
    
     ReadProcessMem ProcessHandle, Address + Offset, Read_DMA_Long, 4&, 0&
     CloseHandle ProcessHandle
    
    End Function
    
    Public Function Read_DMA_Single(Address As Long, Offset As Long) As Single
    Dim ProcessId As Long
        WindowHandle = FindWindow(vbNullString, "Age of Conan")
        If (WindowHandle = 0) Then
            MsgBox "We got no WindowHandle"
            Exit Function
        End If
    
        GetWindowThreadProcessId WindowHandle, ProcessId
        ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId)
        If (ProcessHandle = 0) Then
            MsgBox "We got no ProcessHandle"
            Exit Function
        End If
        
    
    ReadProcessMem ProcessHandle, Address + Offset, Read_DMA_Single, 4&, 0&
    CloseHandle ProcessHandle
    End Function
    
    Public Function Read_DMA_Double(Address As Long, Offset As Long) As Double
    Dim ProcessId As Long
        WindowHandle = FindWindow(vbNullString, "Age of Conan")
        If (WindowHandle = 0) Then
            MsgBox "We got no WindowHandle"
            Exit Function
        End If
    
        GetWindowThreadProcessId WindowHandle, ProcessId
        ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessId)
        If (ProcessHandle = 0) Then
            MsgBox "We got no ProcessHandle"
            Exit Function
        End If
        
    ReadProcessMem ProcessHandle, Address + Offset, Read_DMA_Double, 8&, 0&
    CloseHandle ProcessHandle
    
    End Function
    
    
    '-------
    'Form1
    Private Sub Command1_Click()
    Dim x As Single
    Dim y As Single
    
    
    x = Read_DMA_Single(&H2097BA4, &H124)
    y = Read_DMA_Single(&H2097BA4, &H12C)
    
    List1.Clear
    List1.AddItem "Window: 'Age of Conan'"
    List1.AddItem "WindowHandle: " & WindowHandle
    List1.AddItem "ProcessHandle: " & ProcessHandle
    List1.AddItem " "
    
    List1.AddItem "Player X: " & x
    List1.AddItem "Player Y: " & y
    
    End Sub

  2. #2
    Toymaker's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Location
    Hannah, Montana
    Posts
    659
    Reputation
    14
    Thanks
    193
    My Mood
    Amused
    You do know you don't even have a float in your entire post? A float is a decimal value. Assembly handles decimals by signing values, it's decently irritating to manage. Are you referring to 0xwhatever as a float? You're a silly guy, if so. Else, you must not have posted enough to be helped with the problem you described...

    ...Any way, you're making things pretty difficult. There is virtually no use for any of that code. You can simply 'view what writes to this' in cheat engine and obtain a static address to reverse the ASM of and WriteProcessMem it. Rather than dealing with all those trick methods and formulas.

  3. #3
    freitag's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    ----
    Posts
    3
    Reputation
    10
    Thanks
    0
    ehmm seems like you didn't get what i've written...

    there is no FLOAT in VB like PFLOAT in c++

    0xwhatever is hex and yes i'm pointing to a float value with this and this are pointers.


    Read_DMA_Single(&H2097BA4, &H124)
    function pointer(hex),offset(hex)

    so if there is no use for any of that code...what would be a use? I think you have no clue, no offense but...thx next plz...

  4. #4
    freitag's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    ----
    Posts
    3
    Reputation
    10
    Thanks
    0
    close plz as i got it working

  5. #5
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    o_O im confused... im so nub >_<
    But it looks like he trying to search in age of conan for something???
    Last edited by why06; 07-22-2009 at 08:47 AM.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  6. #6
    Toymaker's Avatar
    Join Date
    Feb 2008
    Gender
    male
    Location
    Hannah, Montana
    Posts
    659
    Reputation
    14
    Thanks
    193
    My Mood
    Amused
    Apparently he got some thing working that even he doesn't actually understand lmao. There are technically no floats in memory reversing, even if the result in the dynamic address you allocated is a float on screen. Oh well, closed...

Similar Threads

  1. VB6 How To Make A CrossHair
    By gunnybunny in forum Visual Basic Programming
    Replies: 3
    Last Post: 07-18-2009, 05:41 PM
  2. Tutorial - How to use Visual Basics 6 (vb6) for WarRock hacks
    By Oneirish in forum Visual Basic Programming
    Replies: 17
    Last Post: 05-26-2008, 07:24 AM
  3. Tutorial - How to use Visual Basics 6 (vb6) for WarRock "easy"
    By Oneirish in forum Programming Tutorials
    Replies: 2
    Last Post: 04-23-2008, 08:23 AM
  4. Video Tut on how to use VB6
    By str1k3r21 in forum Visual Basic Programming
    Replies: 0
    Last Post: 11-05-2007, 05:51 AM
  5. [Tut] superjump in vb6,how to
    By cjg333 in forum General Game Hacking
    Replies: 1
    Last Post: 07-21-2007, 01:17 AM

Tags for this Thread