Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 16:50

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help with reading memory with offsets from game

Discussion on Help with reading memory with offsets from game within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
Help with reading memory with offsets from game

As title say
I have next problem, i have base pointer + adress for solitaire on windows xp 32 bit

but when i enter it in script it returns me 0, but when i start computer and reload cheat engine it shows exact values from game

here is code

Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <NomadMemory.au3>

$GUI = GUICreate("Test memory", 230, 57, 344, 300)
$score = GUICtrlCreateLabel("Curent score : ", 10, 6, 70, 17)
$displayScore = GUICtrlCreateLabel("", 80, 6, 98, 17)
$gameRunning = GUICtrlCreateLabel("", 8, 30, 134, 17)
GUISetState(@SW_SHOW)

$PID = ProcessExists("sol.exe")
$address = 0x000A9510 ; adress for score

Dim $offset[2] = [0, 0x30] ; offset

#cs
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>11</ID>
      <Description>"pointerscan result"</Description>
      <Color>80000008</Color>
      <VariableType>4 Bytes</VariableType>
      <Address>"sol.exe"+00007170</Address>
      <Offsets>
        <Offset>30</Offset>
      </Offsets>
    </CheatEntry>
  </CheatEntries>
</CheatTable>
#ce

_checkprocess()

While 1

	_getscore()

	$nMsg = GUIGetMsg()

	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
	EndSwitch
WEnd

Func _getscore()

	$memOpen = _MemoryOpen($PID)
	$val = _MemoryRead($address, $memOpen, 'dword') ; for this it returns me 16798882
	$val2 = _MemoryPointerRead($address, $memOpen, $offset[1]) ; for this returns me 0

	ConsoleWrite($val & @CRLF & $val2)

	;GUICtrlSetData($displayScore, $val)

	_MemoryClose($memOpen)

EndFunc

Func _checkprocess()
	If $PID = 1 Then
		GUICtrlSetData($gameRunning, "Game is running")
	ElseIf $PID = 0 Then
		GUICtrlSetData($gameRunning, "Game is not running")
	EndIf
EndFunc
mlukac89 is offline  
Old 11/18/2013, 19:40   #2
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Because _MemoryPointerRead returns an array where the last entry contains the value you want.
Code:
$aPointerValues = _MemoryPointerRead(...)

MsgBox(64, "", $aPointerValues[UBound($aPointerValues) - 1])
alpines is offline  
Old 11/18/2013, 19:44   #3
 
Paraly's Avatar
 
elite*gold: 27
Join Date: Sep 2009
Posts: 5,609
Received Thanks: 1,596
try this

Code:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <NomadMemory.au3>

$GUI = GUICreate("Test memory", 230, 57, 344, 300)
$score = GUICtrlCreateLabel("Curent score : ", 10, 6, 70, 17)
$displayScore = GUICtrlCreateLabel("", 80, 6, 98, 17)
$gameRunning = GUICtrlCreateLabel("", 8, 30, 134, 17)
GUISetState(@SW_SHOW)

$PID = ProcessExists("sol.exe")
$address = 0x000A9510 ; adress for score

Dim $offset[1] = [ 0x30] ; offset

#cs
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>11</ID>
      <Description>"pointerscan result"</Description>
      <Color>80000008</Color>
      <VariableType>4 Bytes</VariableType>
      <Address>"sol.exe"+00007170</Address>
      <Offsets>
        <Offset>30</Offset>
      </Offsets>
    </CheatEntry>
  </CheatEntries>
</CheatTable>
#ce

_checkprocess()

While 1

	_getscore()

	$nMsg = GUIGetMsg()

	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
	EndSwitch
WEnd

Func _calc_offset()
	$address = 0x000A9510
	$var = 0
	do
		$address = _MemoryRead($address, $memOpen) + $offset[$var]
		$var = $var + 1
	until $var = UBound($offset)
EndFunc

Func _getscore()

	$memOpen = _MemoryOpen($PID)
	_calc_offset()
	$val = _MemoryRead($address, $memOpen, 'dword') ; for this it returns me 16798882
	$val2 = _MemoryPointerRead($address, $memOpen, $offset[1]) ; for this returns me 0

	ConsoleWrite($val & @CRLF & $val2)

	;GUICtrlSetData($displayScore, $val)

	_MemoryClose($memOpen)

EndFunc

Func _checkprocess()
	If $PID = 1 Then
		GUICtrlSetData($gameRunning, "Game is running")
	ElseIf $PID = 0 Then
		GUICtrlSetData($gameRunning, "Game is not running")
	EndIf
EndFunc
Paraly is offline  
Old 11/18/2013, 19:45   #4
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
ah with that code my program just open and close it wont stay opened

maybe i have wrong NomadMemory ?

here it is


i get this error

C:\Documents and Settings\tea\Desktop\solitaire memory hack\test.au3 (65) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
$val2 = _MemoryPointerRead($address, $memOpen, $offset[1])
$val2 = _MemoryPointerRead($address, $memOpen, ^ ERROR
mlukac89 is offline  
Old 11/18/2013, 20:07   #5
 
alpines's Avatar
 
elite*gold: 60
Join Date: Aug 2009
Posts: 2,256
Received Thanks: 815
Because $offset is one size big and you request the 2nd entry.
By the way the first entry has to be zero. So $offsets[2] [0, offset] would be correct.
alpines is offline  
Old 11/18/2013, 20:21   #6
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
thx for that but i know for arrays and it is like that i fixed it now but im still on 0 result idk what to do anymore
mlukac89 is offline  
Old 11/19/2013, 18:40   #7
 
elite*gold: 15
Join Date: Aug 2012
Posts: 3,041
Received Thanks: 6,397
It's sol.exe+7170 not 0xA9510..
berkay2578 is offline  
Old 11/19/2013, 19:42   #8

 
elite*gold: 64
Join Date: May 2011
Posts: 1,229
Received Thanks: 854
Try that:

Include by KDeluxe:

Code:
;#AutoIt3Wrapper_UseX64=y ;For 64Bit Process Memory
#RequireAdmin
#include <KDMemory.au3>

Local $pID, $hHandle, $iBase, $mName, $iStatAddr
Dim $iOffsets[1] = [ 0x30 ]

$iStatAddr = 0x00007170

$mName = "sol.exe"

$pID = ProcessExists($mName)

$hHandle = _KDMemory_OpenProcess($pID)

$iBase = _KDMemory_GetModuleBaseAddress($hHandle, $mName) + $iStatAddr

$iRead = _KDMemory_ReadProcessMemory($hHandle, $iBase, 'DWORD', $iOffsets)
BladeTiger12 is offline  
Old 11/19/2013, 22:11   #9
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,149
KDeluxe is offline  
Old 11/20/2013, 00:08   #10
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
@BladeTiger12
your code return me FALSE

@KDeluxe
your code give me this error

mlukac89 is offline  
Old 11/20/2013, 13:01   #11
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,149
The call fails, but you need a similar function to get the module address. The address is "sol.exe"+00007170 and not 000A9510. The module address is not static for Solitaire.
KDeluxe is offline  
Old 11/20/2013, 13:56   #12
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
ok but how do i implement that "sol.exe"+0007170 in script to show me current score ?
mlukac89 is offline  
Old 11/20/2013, 15:07   #13
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,149
Quote:
Originally Posted by KDeluxe View Post
But
Quote:
Originally Posted by KDeluxe View Post
The call fails
I can't help you because I don't know what error occurs. Replace the _KDMemory_GetModuleBaseAddress() function in the KDMemory.au3 with
The MsgBox will show you the error. I need the @error code and the @extended code.
KDeluxe is offline  
Old 11/20/2013, 15:34   #14
 
mlukac89's Avatar
 
elite*gold: 0
Join Date: Sep 2010
Posts: 473
Received Thanks: 104
I replaced that code you gived me in KDMemory.au3

and now msg box says

Can't get ModuleBaseAdress! @error:21 @extended:6
mlukac89 is offline  
Old 11/20/2013, 16:48   #15
 
elite*gold: 0
Join Date: Mar 2009
Posts: 7,260
Received Thanks: 33,149


Try it with another access right. Replace
Code:
$handles = _KDMemory_OpenProcess($processId)
with
Code:
$handles = _KDMemory_OpenProcess($processId, 0, 0x001F0FFF)
KDeluxe is offline  
Reply


Similar Threads Similar Threads
[C#]Reading Memory / Pointer with multiple Offsets.
01/12/2013 - .NET Languages - 23 Replies
I am used to coding in AutoIt. I am trying to move my project into C# but I have only about 2-3 weeks of experience. In AutoIt, I have this code here that reads the process memory and returns a value. $map = _MemoryRead(0x00B5CCB8, $handle) // Pointer address 0x00B5CCB8 $map = _MemoryRead($map + 0x02, $handle) // Offset 0x02 $map = _MemoryRead($map + 0xBD, $handle) // Second Offset 0xBD I am trying desperately to convert this to C# language and I need some help. Here is what I have...
[Vb.NET] WoW Memory Reading
11/20/2010 - World of Warcraft - 1 Replies
Hallo, Ist es irgendwie möglich mit VB.NET die Memory von WoW auszulesen wie bei C# mit der BlackMagic.dll Danke m vorraus
Help with memory reading. C++.
06/12/2010 - Aion - 0 Replies
Hello people, I'm kinda new to memory reading in c++. Been doing similiar stuff, and done some other stuff like packet hacks etc but anyway, to the issue. I get weird values from AION when reading. And I'm prolly going about this totally wrong so I'll post you the code and hopefully some kind soul out there will point me in the right direction. int address = 0xA82424; int value; DWORD pid; if(!GameWindow) {
Memory reading etc.
06/18/2008 - General Coding - 11 Replies
-
Memory reading help...
02/10/2007 - Conquer Online 2 - 1 Replies
Hi, I need to read the amount of arrows on an archer (0-500). I have the pointer and offset, and i can get the right number in cheat engine, however whenever i try to read it from autohotkey i always get 0. Don't know why. I've always read 4 byte data before so i don't really know if i have the right code for 2 byte data. Here's the autohotkey code ExtInt&#40;ByRef pSource, pOffset = 0, pIsSigned = false, pSize = 4&#41;; From AutoHotKey Help { Loop %pSize% result += *&#40;&pSource +...



All times are GMT +1. The time now is 16:50.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.