Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

ReadProcessMemory / WriteProcessMemory

  • Please log in to reply
33 replies to this topic
  • Guests
  • Last active:
  • Joined: --
Alright i have a silly question/problem and I hope 1 of you AHK guru's can help me out.

Im trying to read memory from a game but I came across 1 problem.
This is my code
;read the address from an ini so you dont have to change the code everytime
IniRead, char, C:/myfile.ini, Test, Address 
;feed the Address to the var lpszTitle
lpszTitle = %Address%
;the var that will store the result
teststr = 
;the loop to move from eash byte
   ReadProcessMemory, char, %lpszTitle%, ahk_id, [Conquer 2.0]
; the first byte is stored on the variable char 
; If the value of the byte read is zero we are at the end of the string. 
   ; So quit the loop!    
   if char = 0 
   ; Transform the obtained byte's value to a character and save it in char again
   Transform, char, Chr, %char% 
   ; Append the character to our teststr variable that will hold the whole title string 
   teststr = %teststr%%char% 
   ; Increment address by one to obtain next byte 
;display the value
Msgbox, %teststr%

Now I dont now if theres a problem within the code or anything, it just keeps running in a loop it doesnt quit or anything but no messagebox showed up.

this is what my ini file exists of:

Now i know that is the correct memory address but i dont know if AHK can read it like that.
If someone can help me solve this Id be very thankfull :p

  • Members
  • 16 posts
  • Last active: Jan 20 2008 08:48 AM
  • Joined: 09 Nov 2007
If we could writeprocessmemory we will get hackers to ahk

  • Members
  • 2558 posts
  • Last active: Nov 01 2014 03:23 PM
  • Joined: 29 Dec 2004

If we could writeprocessmemory we will get hackers to ahk

They're already here... ;)

  • Members
  • 641 posts
  • Last active: Jan 02 2017 12:17 PM
  • Joined: 12 Jul 2005

If we could writeprocessmemory we will get hackers to ahk

WriteProcessMemory is a simple DllCall. If a hacker isn't able to achive this he isn't a hacker ;)
Writing to foreign memory with AHK is really simple and does work like a charm ;)

Did you try to strip "&h" of the address?
And why do you feed lpszTitle with an empty variable?
With the IniRead you set the value from ini-file to variable "char", but in next code-line you do use the variable "Address"!

Seems to be some copy-paste error...

For further debugging:
It does help to set messageboxes in the code which will show the content of variables.
This way you can get shure that the correct value is used in the function.