Alright so, short story is I've made some nice tools for other online MMORPGs in the past and really haven't been into them for a few years. I've gotten really into diablo 3 since release, and have decided to go about making a nice little library for fellow programmers who don't feel like digging down into deep memory editting and whatnot, and want a nice clean and crisp .dll of tools to keep their programs straightforward.
However, for some reason the offsets and pointers aren't really working for me properly in my program, and I can't figure out why, so I'm guessing Diablo III is using the offsets in a way thats a bit different from what I'm used to.
Here's the important parts of my code:
Code:
Private baseaddress As IntPtr
Public Function GetProcessNames() As List(Of String)
Dim Processes As Process() = Process.GetProcessesByName("Diablo III")
If Processes.Length = 0 Then
MsgBox("Diablo III not detected", MsgBoxStyle.OkOnly)
Stop
End If
Dim names As List(Of String) = New List(Of String)
For Each Process As Process In Processes
Dim handle As IntPtr = Process.Handle
baseaddress = Process.MainModule.BaseAddress
Dim Pointer As String = "005F314C"
Dim Offset As String = "8"
Dim NameAddress As IntPtr = FindAddress(handle, Pointer, Offset)
Dim namebuffer(31) As Byte
ReadProcessMemory(handle, NameAddress, namebuffer, namebuffer.Length, Nothing)
names.Add(System.Text.Encoding.ASCII.GetString(namebuffer))
Next
Return names
End Function
Private Function FindAddress(ByVal pHandle As IntPtr, ByVal Staticpointer As String, ByVal Offset As String) As IntPtr
Dim buffer(3) As Byte
Dim TrueAddress As IntPtr = Convert.ToInt32(Staticpointer, 16) + baseaddress
ReadProcessMemory(pHandle, TrueAddress, buffer, 4, 0)
TrueAddress = BitConverter.ToInt32(buffer, 0) + Convert.ToInt32(Offset, 16) <--------
ReadProcessMemory(pHandle, TrueAddress, buffer, 4, 0)
Return BitConverter.ToInt32(buffer, 0)
End Function
However at the line I have the arrow at, the conversion gives me a giant negative int, and then when I try to read that memory I just get 0 0 0 0
As far as I remember my base address and stat pointer are fine, here's my output from cheatengine I used and the offsets it gave me.
Even if Im supposed to use all 4 offsets, the first one isn't even working let alone letting me keep going down the chain
Am I just missing something obvious here? Also when I just run this code:
Code:
ReadProcessMemory(handle, Convert.ToInt32("08F62518", 16), namebuffer, namebuffer.Length, Nothing)
names.Add(System.Text.Encoding.ASCII.GetString(namebuffer))
Where 08F62518 is the current memory location of my character's name, it outputs it nice and neat for me, so I know I imported ReadProcessMemory perfectly fine. :|