Sign in to follow this  
Followers 0
kyler

Memory Pointer Problems

4 posts in this topic

#1 ·  Posted (edited)

Hey guys, I've been searching and reading the forums (thats how I got as far as I am) but for some reason I can't quite get this to work. I am trying to read my character's experience from the game League of Legends (not to make a bot, just to make a custom overlay for my game). I have used Cheat Engine to find the correct offsets and base address but can't get the correct address in Autoit. Below is my code. I am thinking I have made some simple error and would greatly appreciate any help. Thanks!

#RequireAdmin

#include <Nomad_Memory.au3>


$ProcessID = ProcessExists("League of Legends.exe");WinGetProcess("League of Legends (TM) Client")

$var = _Readpointerscan($ProcessID)

MsgBox(0,"",$var[0] & @CRLF & $var[1])

Func _Readpointerscan($pid)

    Global $pointerscanOffset[6]
    $pointerscanOffset[0] = 0
    $pointerscanOffset[1] = Dec("0x00B0")
    $pointerscanOffset[2] = Dec("0x0008")
    $pointerscanOffset[3] = Dec("0x0120")
    $pointerscanOffset[4] = Dec("0x0010")
    $pointerscanOffset[5] = Dec("0x0264")
    $StaticOffset = Dec("0x0067FB8C")
    $openmem = _MemoryOpen($pid)
    $baseADDR = _MemoryGetBaseAddress($openmem, 1)

    ;MsgBox(0,"",Hex($baseADDR))

    $finalADDR = "0x" & Hex($baseADDR + $StaticOffset)
    ;MsgBox(0,"",$finalADDR)
    $MemPointer = _MemoryPointerRead($finalADDR, $openmem, $pointerscanOffset)
    ;$MemPointer = _memoryread(0x0B0D7A94,$openmem)
    _MemoryClose($openmem)

    Return $MemPointer
EndFunc

Func _MemoryGetBaseAddress($ah_Handle, $iHexDec = 0)

    Local $iv_Address = 0x00100000
    Local $v_Buffer = DllStructCreate('dword;dword;dword;dword;dword;dword;dword')
    Local $vData
    Local $vType

    If Not IsArray($ah_Handle) Then
        SetError(1)
        Return 0
    EndIf


    DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))

    If Not @Error Then

        $vData = Hex(DllStructGetData($v_Buffer, 2))
        $vType = Hex(DllStructGetData($v_Buffer, 3))

        While $vType <> "00000080"
            DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))
            $vData = Hex(DllStructGetData($v_Buffer, 2))
            $vType = Hex(DllStructGetData($v_Buffer, 3))
            If Hex($iv_Address) = "01000000" Then ExitLoop
            $iv_Address += 65536

        WEnd

        If $vType = "00000080" Then
            SetError(0)
            If $iHexDec = 1 Then
                Return Dec($vData)
            Else
                Return $vData
            EndIf

        Else
            SetError(2)
            Return 0
        EndIf

    Else
        SetError(3)
        Return 0
    EndIf

EndFunc

Edit: If it matters I am using Windows 7 32-bit.

Edited by kyler

Share this post


Link to post
Share on other sites



Good luck with this kyler.

If you had paid attention to the forums you would have discovered we don't want AutoIt associated with game cheats in any way at all.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Good luck with this kyler.

If you had paid attention to the forums you would have discovered we don't want AutoIt associated with game cheats in any way at all.

Ya, I can understand that. If an overlay is too close to a cheat thats okay. To better explain myself, however, my goal is to improve the interface of the game slightly since I am running a dual screen setup so I have to space to make some of the game's information more easily readable. Again, if mods deem this too close to a cheat I'll accept that.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hey guys, I've been searching and reading the forums (thats how I got as far as I am) but for some reason I can't quite get this to work. I am trying to read my character's experience from the game League of Legends (not to make a bot, just to make a custom overlay for my game). I have used Cheat Engine to find the correct offsets and base address but can't get the correct address in Autoit. Below is my code. I am thinking I have made some simple error and would greatly appreciate any help. Thanks!

#RequireAdmin

#include <Nomad_Memory.au3>


$ProcessID = ProcessExists("League of Legends.exe");WinGetProcess("League of Legends (TM) Client")

$var = _Readpointerscan($ProcessID)

MsgBox(0,"",$var[0] & @CRLF & $var[1])

Func _Readpointerscan($pid)

    Global $pointerscanOffset[6]
    $pointerscanOffset[0] = 0
    $pointerscanOffset[1] = Dec("0x00B0")
    $pointerscanOffset[2] = Dec("0x0008")
    $pointerscanOffset[3] = Dec("0x0120")
    $pointerscanOffset[4] = Dec("0x0010")
    $pointerscanOffset[5] = Dec("0x0264")
    $StaticOffset = Dec("0x0067FB8C")
    $openmem = _MemoryOpen($pid)
    $baseADDR = _MemoryGetBaseAddress($openmem, 1)

    ;MsgBox(0,"",Hex($baseADDR))

    $finalADDR = "0x" & Hex($baseADDR + $StaticOffset)
    ;MsgBox(0,"",$finalADDR)
    $MemPointer = _MemoryPointerRead($finalADDR, $openmem, $pointerscanOffset)
    ;$MemPointer = _memoryread(0x0B0D7A94,$openmem)
    _MemoryClose($openmem)

    Return $MemPointer
EndFunc

Func _MemoryGetBaseAddress($ah_Handle, $iHexDec = 0)

    Local $iv_Address = 0x00100000
    Local $v_Buffer = DllStructCreate('dword;dword;dword;dword;dword;dword;dword')
    Local $vData
    Local $vType

    If Not IsArray($ah_Handle) Then
        SetError(1)
        Return 0
    EndIf


    DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))

    If Not @Error Then

        $vData = Hex(DllStructGetData($v_Buffer, 2))
        $vType = Hex(DllStructGetData($v_Buffer, 3))

        While $vType <> "00000080"
            DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))
            $vData = Hex(DllStructGetData($v_Buffer, 2))
            $vType = Hex(DllStructGetData($v_Buffer, 3))
            If Hex($iv_Address) = "01000000" Then ExitLoop
            $iv_Address += 65536

        WEnd

        If $vType = "00000080" Then
            SetError(0)
            If $iHexDec = 1 Then
                Return Dec($vData)
            Else
                Return $vData
            EndIf

        Else
            SetError(2)
            Return 0
        EndIf

    Else
        SetError(3)
        Return 0
    EndIf

EndFunc

Edit: If it matters I am using Windows 7 32-bit.

Did you tried this?

Global $pointerscanOffset[6]

$pointerscanOffset[0] = 0

$pointerscanOffset[1] = Dec("0x00B0")

$pointerscanOffset[2] = Dec("0x0008")

$pointerscanOffset[3] = Dec("0x0120")

$pointerscanOffset[4] = Dec("0x0010")

$pointerscanOffset[5] = Dec("0x0264")

$StaticOffset = Dec("0x0067FB8C")

$openmem = _MemoryOpen($pid)

$baseADDR = _MemoryGetBaseAddress($openmem, 1)

;MsgBox(0,"",Hex($baseADDR))

$finalADDR = "0x" & Hex($baseADDR + $StaticOffset)

;MsgBox(0,"",$finalADDR)

$MemPointer = _MemoryPointerRead($finalADDR, $openmem, $pointerscanOffset)

Msgbox(0, "", _MemoryRead($MemPointer[0], $Openmem))

_MemoryClose($openmem)

Edited by acealone

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0