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 


[AutoIt Release] KryMemory

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
KryziK
Expert Cheater
Reputation: 3

Joined: 16 Aug 2009
Posts: 199

PostPosted: Sat Jan 12, 2013 4:00 pm    Post subject: [AutoIt Release] KryMemory Reply with quote

For any of you using AutoIt out there, this is a simple library that replaces NomadMemory. These functions are more efficient and also provide more functionality than NomadMemory, but they work almost the same way.

This small library took me a total of a few hours to write, test, and document. However, much testing is left to do. The error checking could also be extended a bit more to account for new users. If you have any suggestions or find any bugs, do not hesitate to reply here. Make sure you include the code that caused the error, your operating system information, and any other relevant information.

Anyways, here it is:
KryMemory Library Download

Documented Functions:
Code:
; _Process_Open($sProcessName, $iDesiredAccess = $PROCESS_ALL_ACCESS, $fInheritAccess = False)
; _Process_Close($ahHandle)
; _Process_ReadMemory($ahHandle, $ivAddress, $sType = "dword")
; _Process_ReadMemoryPointer($ahHandle, $ivAddress, $aiOffsets, $sType = "dword")
; _Process_WriteMemory($ahHandle, $ivAddress, $vData, $sType = "dword")
; _Process_WriteMemoryPointer($ahHandle, $ivAddress, $aiOffsets, $vData, $sType = "dword")
; _Process_GetBaseAddress($ahHandle)
; _Process_GetParent($ahHandle)
; _Process_GetModules($ahHandle)
;
; _Address_CalculateStatic($ahHandle, $sModuleName, $ivOffset)
; _Address_CalculatePointer($ahHandle, $ivAddress, $aiOffsets)
;
; _Module_GetBaseAddress($ahHandle, $sModuleName)


Example Script:
Code:
#include "KryMemory.au3"

; Opens Cheat Engine's Tutorial (v3.2).
Local $oProc = _Process_Open("Tutorial-i386.exe")

; Makes sure the process was opened.
If @error Then
   ConsoleWriteError("The specified process could not be opened. Error: " & @error & @CRLF)
   Exit(0)
EndIf

; Lists all of the modules in the process and their base address in a nice, pretty table.
ConsoleWrite(StringFormat("%-25s%-25s", "Module Name", "Base Address") & @CRLF)
ConsoleWrite("-------------------------------------" & @CRLF)
For $sModule in _Process_GetModules($oProc)
   ConsoleWrite(StringFormat("%-25s  0x%08X", $sModule, _Module_GetBaseAddress($oProc, $sModule)) & @CRLF)
Next

ConsoleWrite(@CRLF)

; Calculates the address of the value to change in Step 2.
Local $aiOffsets_StepTwo[1] = [0x464]
Local $iAddress_StepTwo = _Address_CalculatePointer($oProc, 0x00690320, $aiOffsets_StepTwo)

; Reads and displays the address and value to change in Step 2.
ConsoleWrite(StringFormat("0x%08X: %i", $iAddress_StepTwo, _Process_ReadMemory($oProc, $iAddress_StepTwo)) & @CRLF)

; Changes the value of the variable in Step 2 to 1000 to unlock the next level.
_Process_WriteMemory($oProc, $iAddress_StepTwo, 1000)

; Closes the handles created by _ProcessOpen.
_Process_Close($oProc)
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 204

Joined: 25 Jan 2006
Posts: 8579
Location: 127.0.0.1

PostPosted: Sat Jan 12, 2013 8:04 pm    Post subject: Reply with quote

Comparing the two I fail to see how yours is any more "efficient" given that it is the same exact stuff just with some things renamed and altered slightly. I doubt you are going to get anyone to use it if that is your "sales pitch" for it since most will just look at it and see the same thing.

Might want to go back and do things different entirely, add more features that will interest people more, or do something major that will get people interested in switching to it.

As it looks now, you just renamed the functions and some variables and slightly changed some minor things.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
KryziK
Expert Cheater
Reputation: 3

Joined: 16 Aug 2009
Posts: 199

PostPosted: Sat Jan 12, 2013 10:00 pm    Post subject: Reply with quote

Honestly, I don't care if people use it or not. I made it for a friend and posted it here for everyone else. It is a bit more efficient and stable in terms of the DllCalls and what not, but most people probably won't notice the difference. I did write it from scratch, though. I used the array of handles idea because of the lack of classes, but that's about it.

Edit: Also, some versions of NomadMemory float around without certain functions that others have. This has that extra function or two, and hopefully is pretty easy to understand for beginners.
Back to top
View user's profile Send private message
NoobCheaterhaha
How do I cheat?
Reputation: 0

Joined: 08 May 2013
Posts: 7

PostPosted: Fri Aug 30, 2013 8:25 am    Post subject: Reply with quote

I am sorry dude but it doesn't work at all with CE either I tested above code with tutorial step2 (doesnt change value) then I applied my adress + offset too (there is a little difference) and it failed..


I have CE 6.3 and Autoit3 3.3.8.1
Back to top
View user's profile Send private message
KryziK
Expert Cheater
Reputation: 3

Joined: 16 Aug 2009
Posts: 199

PostPosted: Fri Aug 30, 2013 9:38 am    Post subject: Reply with quote

NoobCheaterhaha wrote:
I am sorry dude but it doesn't work at all with CE either I tested above code with tutorial step2 (doesnt change value) then I applied my adress + offset too (there is a little difference) and it failed..


I have CE 6.3 and Autoit3 3.3.8.1


I'm going to need more information to try and help you. Sometimes new versions of AutoIt don't work the same as they used to, but I can't see that being the issue. Can you post more info like what address and offsets you're trying, perhaps with a screenshot of CE and even the lines of AutoIt code?

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

Joined: 08 May 2013
Posts: 7

PostPosted: Sat Aug 31, 2013 3:45 am    Post subject: Reply with quote

Hi, I forgot to mention that my OS is Win7 64bits.


I added cheat table to attachments
Au3 script: Just changed offset + Adress according to cheat table

Code:

#include "KryMemory.au3"

 ; Opens Cheat Engine's Tutorial (v3.2).
 Local $oProc = _Process_Open("Tutorial-i386.exe")

 ; Makes sure the process was opened.
 If @error Then
    ConsoleWriteError("The specified process could not be opened. Error: " & @error & @CRLF)
    Exit(0)
 EndIf

 ; Lists all of the modules in the process and their base address in a nice, pretty table.
 ConsoleWrite(StringFormat("%-25s%-25s", "Module Name", "Base Address") & @CRLF)
 ConsoleWrite("-------------------------------------" & @CRLF)
 For $sModule in _Process_GetModules($oProc)
    ConsoleWrite(StringFormat("%-25s  0x%08X", $sModule, _Module_GetBaseAddress($oProc, $sModule)) & @CRLF)
 Next

 ConsoleWrite(@CRLF)

 ; Calculates the address of the value to change in Step 2.
 Local $aiOffsets_StepTwo[1] = [0x480]
 Local $iAddress_StepTwo = _Address_CalculatePointer($oProc, 0x231300, $aiOffsets_StepTwo)

 ; Reads and displays the address and value to change in Step 2.
 ConsoleWrite(StringFormat("0x%08X: %i", $iAddress_StepTwo, _Process_ReadMemory($oProc, $iAddress_StepTwo)) & @CRLF)

 ; Changes the value of the variable in Step 2 to 1000 to unlock the next level.
 _Process_WriteMemory($oProc, $iAddress_StepTwo, 1000)

 ; Closes the handles created by _ProcessOpen.
 _Process_Close($oProc)



Tutorial-i386 [CE 6.3] STEP 2.CT
 Description:

Download
 Filename:  Tutorial-i386 [CE 6.3] STEP 2.CT
 Filesize:  451 Bytes
 Downloaded:  8696 Time(s)

Back to top
View user's profile Send private message
KryziK
Expert Cheater
Reputation: 3

Joined: 16 Aug 2009
Posts: 199

PostPosted: Wed Sep 04, 2013 2:07 pm    Post subject: Reply with quote

NoobCheaterhaha wrote:
Hi, I forgot to mention that my OS is Win7 64bits.


I added cheat table to attachments
Au3 script: Just changed offset + Adress according to cheat table

Code:

#include "KryMemory.au3"

 ; Opens Cheat Engine's Tutorial (v3.2).
 Local $oProc = _Process_Open("Tutorial-i386.exe")

 ; Makes sure the process was opened.
 If @error Then
    ConsoleWriteError("The specified process could not be opened. Error: " & @error & @CRLF)
    Exit(0)
 EndIf

 ; Lists all of the modules in the process and their base address in a nice, pretty table.
 ConsoleWrite(StringFormat("%-25s%-25s", "Module Name", "Base Address") & @CRLF)
 ConsoleWrite("-------------------------------------" & @CRLF)
 For $sModule in _Process_GetModules($oProc)
    ConsoleWrite(StringFormat("%-25s  0x%08X", $sModule, _Module_GetBaseAddress($oProc, $sModule)) & @CRLF)
 Next

 ConsoleWrite(@CRLF)

 ; Calculates the address of the value to change in Step 2.
 Local $aiOffsets_StepTwo[1] = [0x480]
 Local $iAddress_StepTwo = _Address_CalculatePointer($oProc, 0x231300, $aiOffsets_StepTwo)

 ; Reads and displays the address and value to change in Step 2.
 ConsoleWrite(StringFormat("0x%08X: %i", $iAddress_StepTwo, _Process_ReadMemory($oProc, $iAddress_StepTwo)) & @CRLF)

 ; Changes the value of the variable in Step 2 to 1000 to unlock the next level.
 _Process_WriteMemory($oProc, $iAddress_StepTwo, 1000)

 ; Closes the handles created by _ProcessOpen.
 _Process_Close($oProc)


"Local $iAddress_StepTwo = _Address_CalculatePointer($oProc, 0x231300, $aiOffsets_StepTwo)" is the problem it would seem.
0x231300 is the offset from Tutorial-i386.exe. You either need to add it to the base address of that process or just use 0x631300.

Let me know if that solves your problem.
Back to top
View user's profile Send private message
NoobCheaterhaha
How do I cheat?
Reputation: 0

Joined: 08 May 2013
Posts: 7

PostPosted: Thu Sep 05, 2013 1:24 pm    Post subject: Reply with quote

Thanks it works with 0x631300 adress ,but I don't understand why you chose this specific adress. Can you explain me?

Last edited by NoobCheaterhaha on Thu Sep 05, 2013 1:36 pm; edited 2 times in total
Back to top
View user's profile Send private message
KryziK
Expert Cheater
Reputation: 3

Joined: 16 Aug 2009
Posts: 199

PostPosted: Thu Sep 05, 2013 1:26 pm    Post subject: Reply with quote

NoobCheaterhaha wrote:
Thanks it works with 0x631300 adress ,but I don't understand why you chose this specific adress. Can you explain me?


Tutorial-i386.exe+0x231300 is the same as 0x631300 in this case due to the fact that Tutorial-i386.exxe happens to be 0x400000 (common, but not always true for processes).

The substitute to 0x631300 would be GetModuleBaseAddress on Tutorial-i386.exe and add 0x231300 to it.
Back to top
View user's profile Send private message
NoobCheaterhaha
How do I cheat?
Reputation: 0

Joined: 08 May 2013
Posts: 7

PostPosted: Thu Sep 05, 2013 1:36 pm    Post subject: Reply with quote

Okay thanks.

Btw

could you add function to execute asm code?

edit

offsets must be writed inversely from bottom to top in CE
Back to top
View user's profile Send private message
Shinobi_Mega
How do I cheat?
Reputation: 0

Joined: 25 Jan 2022
Posts: 7

PostPosted: Thu Aug 15, 2024 2:15 am    Post subject: Reply with quote

Very Happy


I have a problem reading the module address, could you help me or explain where I'm going wrong? Thank you for your help so far.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming 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