Quote:
Originally Posted by lesderid
By the posts of the requester, I saw he wasn't really experienced.
That's why I tried to tell you to note these things when you release something to less-experienced people.
|
i see :)
i would propose to Janick to use autoit if it is just simple memory reading.
this works pretty well, too and you don't need to have much knowledge about programming to create a simple program. As i read on your first post you want to create a gui to display the stats of a character.
simple example using autoit:
Code:
Global $OLD_char, $OLD_hp
Global $Process = _MemoryOpen(WinGetProcess("SRO_Client"))
Global $Pointer_char = 0x00A9FB98
Global $Pointer_Base = 0x00A8913C
Global $Pointer_maxhp = 0x00AA0740
Global $Offset_curhp = 0x1D4
GUICreate("Char Display", 200, 100)
GUICtrlCreateLabel("Charname:", 10, 20)
$Label_char = GUICtrlCreateLabel("", 70, 20, 100)
GUICtrlCreateLabel("HP:", 10, 40)
$Label_hp = GUICtrlCreateLabel("", 70, 40, 100)
GUISetState()
While 1
Switch GUIGetMsg()
Case -3
Exit
EndSwitch
_CharUpdate()
WEnd
Func _CharUpdate()
Local $READ_char, $READ_maxhp, $READ_Base, $READ_curhp
$READ_char = _MemoryRead($Pointer_char, $Process, "char[40]")
$READ_maxhp = _MemoryRead($Pointer_maxhp, $Process)
$READ_Base = _MemoryRead($Pointer_Base, $Process)
$READ_curhp = _MemoryRead($READ_Base + $Offset_curhp, $Process)
If $READ_char <> $OLD_char Then
$OLD_char = $READ_char
GUICtrlSetData($Label_char, $READ_char)
EndIf
If $READ_curhp <> $OLD_hp Then
$OLD_hp = $READ_curhp
GUICtrlSetData($Label_hp, $READ_curhp & " / " & $READ_maxhp)
EndIf
EndFunc
Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $iv_InheritHandle = 1)
Local $ah_Handle[2] = [DllOpen('kernel32.dll')]
Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $iv_InheritHandle, 'int', $iv_Pid)
$ah_Handle[1] = $av_OpenProcess[0]
Return $ah_Handle
EndFunc ;==>_MemoryOpen
Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'dword')
Local $v_Buffer = DllStructCreate($sv_Type)
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
Local $v_Value = DllStructGetData($v_Buffer, 1)
Return $v_Value
EndFunc ;==>_MemoryRead