|
-
Feb 7th, 2013, 12:23 PM
#1
Thread Starter
Lively Member
Adding hex together and pointers
Hi !
I dont want to make any cheat/other malicious software.From some time im making a GTA:SA program that will save my money,health and few other things to a file, and then i will like to make it so someone else will be able to check out my "stats"
I got already money (im using this class to get memory access:
Code:
Module accessMemory
Const PROCESS_VM_OPERATION As Integer = &H8
Const PROCESS_VM_READ As Integer = &H10
Const PROCESS_VM_WRITE As Integer = &H20
Public Declare Function OpenProcess Lib "Kernel32" Alias "OpenProcess" (ByVal dwDesiredAccess As Integer, ByVal bInheritHandle As Boolean, ByVal dwProcessId As Integer) As IntPtr
Public Declare Function ReadProcessMemory Lib "kernel32.dll" (ByVal processHandle As IntPtr, ByVal BaseAddress As Integer, ByVal Buffer As IntPtr, ByVal Size As Integer, ByRef OutputSize As Integer) As Boolean
Public Declare Function WriteProcessMemory Lib "kernel32.dll" (ByVal processHandle As IntPtr, ByVal BaseAddress As Integer, ByVal Buffer As IntPtr, ByVal Size As Integer, ByRef OutputSize As Integer) As Boolean
Public Declare Function CloseHandle Lib "Kernel32" Alias "CloseHandle" (ByVal hObject As IntPtr) As Boolean
Public Function ReadVariable(ByVal pID As Integer, ByVal variableAddress As Integer, ByVal variableSize As Integer, ByRef localBuffer() As Byte) As Integer
Dim hProcess As IntPtr = OpenProcess(PROCESS_VM_READ, False, pID)
If hProcess = IntPtr.Zero Then Return 0
Dim outputSize As Integer
Dim tempGC As Runtime.InteropServices.GCHandle = Runtime.InteropServices.GCHandle.Alloc(localBuffer, Runtime.InteropServices.GCHandleType.Pinned)
If Not ReadProcessMemory(hProcess, variableAddress, tempGC.AddrOfPinnedObject, variableSize, outputSize) Then outputSize = 0
tempGC.Free()
CloseHandle(hProcess)
Return outputSize
End Function
Public Function WriteVariable(ByVal pID As Integer, ByVal variableAddress As Integer, ByVal variableSize As Integer, ByVal localBuffer() As Byte) As Integer
Dim hProcess As IntPtr = OpenProcess(PROCESS_VM_WRITE Or PROCESS_VM_OPERATION, False, pID)
If hProcess = IntPtr.Zero Then Return 0
Dim outputSize As Integer
Dim tempHandle As IntPtr = Runtime.InteropServices.Marshal.AllocHGlobal(variableSize)
Runtime.InteropServices.Marshal.Copy(localBuffer, 0, tempHandle, variableSize)
If Not WriteProcessMemory(hProcess, variableAddress, tempHandle, variableSize, outputSize) Then outputSize = 0
Runtime.InteropServices.Marshal.FreeHGlobal(tempHandle)
CloseHandle(hProcess)
Return outputSize
End Function
End Module
but Health address is dynamic, to get proper address i need to use pointer, i can do this in Cheat Engine, but i dont want to change the value but to read it and then put into some variable/label.
I have done this in Cheat Engine, i will post a screenshot from CE

Is it possible to do in VB.NET ?
-
Feb 7th, 2013, 03:30 PM
#2
Thread Starter
Lively Member
Re: Adding hex together and pointers
0xB6F5F0 is your pointer.
0x540 is your offset.
0x0A6013E0 is your health address on GTA.
So: 0xB6F5F0 + 0x540 -> 0x0A6013E0
ReadProcessMemory in VB.NET to read that pointer, then add the offset to the result of RPM and RPM again with the result, convert it to float.
Could omeone "translate" it for me ?
-
Feb 7th, 2013, 03:48 PM
#3
Hyperactive Member
Re: Adding hex together and pointers
Firstly, we normally don't offer too much help on this as it can be used for malicious things. Not saying you are doing that, but it is hard to know for a fact.
Since you mentioned it was dynamic, is 0xB6F5F0 always the same memory address when you shutdown the application and reload it?
-
Feb 8th, 2013, 09:13 AM
#4
Thread Starter
Lively Member
Re: Adding hex together and pointers
Yes, the pointer is always the same, and offset too.I found some info already, i will try it out later.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|