Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[Solved] Autohotkey, DllCall-ReadProcessMemory

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
ameyrick
How do I cheat?
Reputation: 0

Joined: 28 Sep 2011
Posts: 3

PostPosted: Wed Sep 28, 2011 4:53 pm    Post subject: [Solved] Autohotkey, DllCall-ReadProcessMemory Reply with quote

Hi, I'm new to CE only started using it about a week ago.

So far I have managed to find a 3 level pointer for the character name in FFXIV.
Code:
Pointer := 0x00E8D368
offset0 := 0x144
offset1 := 0xE0
offset2 := 0xE2


Using AHK I can read the "dynamic" address, But the results are returned as it's 4 Bytes data type.

My first question is.. Using AHK, How can I return this value as it's String[30] non-unicode data type? Like you can in CE.

My next issue is.. Using AHK, How can I read the value from the pointer& offsets?

I believe it's a problem with my DllCall but all my attempts Have so far failed.

Here's my attempt so far:
Code:
;//function ReadMemory
ReadMemory(MADDRESS,PROGRAM = "ffxivgame.exe")
{
   Process, wait, %PROGRAM%, 0.5
   pid = %ErrorLevel%
   if pid = 0
   {
      MsgBox The specified process could not be found.
      return
   }

   VarSetCapacity(MVALUE,4,0)
   ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "Uint")
   DllCall("ReadProcessMemory","UInt",ProcessHandle,"Uint",MADDRESS,"Str",MVALUE,"UInt",4,"str P",0)

   Loop 4
   result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)

   DllCall("CloseHandle", "int", ProcessHandle)
   
   return, result 
}

;//Current Dynamic address
DynAddr := 0x07A9EE7A       
DynResult := ReadMemory(DynAddr)

;//Static Pointer
Pointer := 0x00E8D368
offset0 := 0x144
offset1 := 0xE0
offset2 := 0xE2

   addr0 := ReadMemory(Pointer)
   loop,3
   {
      i := (A_Index - 1)
      addr%i% := addr%i% + offset%i%
      addr := addr%i%
      addr%A_Index% := ReadMemory(addr)
   }


;//View results
ListVars

`::
Reload



Any help would be greatly appreciated. Thanks!


Last edited by ameyrick on Sun Oct 02, 2011 3:01 pm; edited 1 time in total
Back to top
View user's profile Send private message
ameyrick
How do I cheat?
Reputation: 0

Joined: 28 Sep 2011
Posts: 3

PostPosted: Sat Oct 01, 2011 11:39 am    Post subject: Reply with quote

Ok, using Autohotkey, I can now read strings from a specified memory address.

But can't seem to do it with a lvl-3 pointer, In CE this pointer always returns the Character name. I just cannot replicate it in ahk.

Any help with reading multi pointers in AHK would be much appreciated, thanks!

Code:
;//function ReadMemory
ReadMemory(MADDRESS, pOffset = 0, PROGRAM = "ffxivgame.exe")
{
         Process, wait, %PROGRAM%, 0.5
         pid = %ErrorLevel%
         if pid = 0
         {
            MsgBox The specified process could not be found.
            return
         }
         VarSetCapacity(MVALUE,4)
         ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
         DllCall("ReadProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS+pOffset, "Str", MVALUE, "Uint",4, "Uint *",0)
         DllCall("CloseHandle", "int", ProcessHandle)
         Loop 4
            result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
            
         return result
}


;//function ReadMemory_Str
ReadMemory_Str(MADDRESS, pOffset = 0, PROGRAM = "ffxivgame.exe")
{
         Process, wait, %PROGRAM%, 0.5
         pid = %ErrorLevel%
         if pid = 0
         {
            MsgBox The specified process could not be found.
            return
         }
         ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "Uint")
         teststr =
         Loop
         {
            Output := "x"  ; Put exactly one character in as a placeholder. used to break loop on null
            tempVar := DllCall("ReadProcessMemory", "UInt", ProcessHandle, "UInt", MADDRESS+pOffset, "str", Output, "Uint", 1, "Uint *", 0)
            if (ErrorLevel or !tempVar)
            {
              DllCall("CloseHandle", "int", ProcessHandle)
              return teststr
            }
            if Output =
              break
         
            teststr = %teststr%%Output%
            MADDRESS++
         }
         DllCall("CloseHandle", "int", ProcessHandle)
         return, teststr 
}



;//Current Dynamic address
DynAddr := 0x07A9EE7A       
DynResult := ReadMemory_Str(DynAddr) ;//Returns: Character name in FFXIV

;//Three lvl Pointer in CE which always Points to the Character name
Pointer := 0x00E8D368
offset0 := 0x144
offset1 := 0xE0
offset2 := 0xE2

PointerResult1 := ReadMemory(Pointer, offset0)
PointerResult2 := ReadMemory(PointerResult1, offset1)

PointerResult3 := ReadMemory_Str(PointerResult2, offset2) ;//??? Does not Return: Character name in FFXIV ???

ListVars

`::
Reload




ce_ffxiv_cname.PNG
 Description:
 Filesize:  17.5 KB
 Viewed:  10143 Time(s)

ce_ffxiv_cname.PNG


Back to top
View user's profile Send private message
ameyrick
How do I cheat?
Reputation: 0

Joined: 28 Sep 2011
Posts: 3

PostPosted: Sun Oct 02, 2011 3:01 pm    Post subject: Reply with quote

Resolved with help from ahk forum:

Code:
www . autohotkey . com / forum / viewtopic.php ?t=76989
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites