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

Posts 1–6 of 6 · Page 1 of 1
[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
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.
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...
close plz as i got it working
o_O im confused... im so nub >_<
But it looks like he trying to search in age of conan for something???
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...
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?