Author | Message | Time |
---|---|---|
phvckmeh | I need to learn how to read Diablo 2 ingame text with visual basic. I hope to create two things, one that logs all in game text. And the other will be a stats program for pk rooms, that logs kills, deaths etc. i know i will need to use ReadProcessMemory Thx Guys!!! | May 2, 2004, 4:56 AM |
iago | I don't think you'll be able to do this with vb. At least, not easily. The best way would be to inject code and log chat functions, but vb can't (or can barely) go to that low level. | May 2, 2004, 6:08 AM |
phvckmeh | ive seen it done :D for example [code]Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long Private Sub Main() Const PROCESS_ALL_ACCESS = &H1F0FFF Dim pindIni As New IniEditor Dim windowname As String windowname = "Diablo II" Dim health As Long Dim diablohwnd As Long diablohwnd = FindWindow(vbNullString, windowname) If (diablohwnd = 0) Then MsgBox windowname & " must be running" Exit Sub End If Dim diablopid As Long GetWindowThreadProcessId diablohwnd, diablopid Dim pHandle As Long pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, diablopid) If (pHandle = 0) Then MsgBox "Couldn't get a handle, please ensure that " & windowname & " is running" Exit Sub End If Dim buf As Long Dim addy As Long addy = &H6FBBC200 ReadProcessMemory pHandle, addy, buf, 4, 0& addy = buf + &H5C ReadProcessMemory pHandle, addy, buf, 4, 0& addy = buf + &H10 ReadProcessMemory pHandle, addy, buf, 4, 0& If buf And &H80000000 Then addy = addy + &H38 Else addy = addy + &H14 End If ReadProcessMemory pHandle, addy, buf, 4, 0& health = buf + &H25 ReadProcessMemory pHandle, health, buf, 4, 0& MsgBox buf CloseHandle (pHandle) End Sub [/code] that will grab your life in game, (and save it to INI) | May 2, 2004, 7:34 AM |
Dyndrilliac | You might take a peek at the games Send() winsock function. Hook it and copy the text as the client sends it. | May 2, 2004, 8:48 AM |
TheMinistered | He doesn't want to get the data being sent out by his client. He wants to get the data received by his client. Thus, he does not want to hook Send! Rather, if he chooses to use hooking as his method of choice, Recv! If not, then he should try to find the function(s) that display text to the screen. | May 2, 2004, 10:34 PM |
Dyndrilliac | Either way you slice it, he's getting half of what he wants done(Logging all text). I was just using the Send() as an example. | May 3, 2004, 7:28 PM |
phvckmeh | how whould i do this! | May 4, 2004, 1:26 AM |
Dyndrilliac | Research hooking. | May 4, 2004, 2:51 AM |