Difference between revisions of "Code injection"

From Cheat Engine
Jump to navigation Jump to search
(Added s'more)
Line 6: Line 6:
 
One use of code injection is for finding dynamic addresses that tend to change each time the game is run. By placing a code injection on a routine that accesses that address, like a user interface update routine, you can find the address of that specific variable.
 
One use of code injection is for finding dynamic addresses that tend to change each time the game is run. By placing a code injection on a routine that accesses that address, like a user interface update routine, you can find the address of that specific variable.
  
CE supports [[AOB Injection]] and [[Code Injection]]. [[AOB Injection]] and [[Code Injection]] are really the same thing except in case of [[AOB Injection]], the injection point is scanned and found in the code using a specific signature (AOB = array of byte) while Code Injection uses hard-coded addresses. Since [[AOB Injection]] performs a scan, it often takes some time to enable a script containing an [[AOB Injection]]. In contrast, [[Code Injection]]-based scripts can always be enabled instantly because the injection address is known.
+
CE supports [[AOB Injection]] and [[Code Injection]] in AA (auto-assemble) scripts. [[AOB Injection]] and [[Code Injection]] are really the same thing except in case of [[AOB Injection]], the injection point is scanned and found in the code using a specific signature (AOB = array of byte) while Code Injection uses hard-coded addresses. Since [[AOB Injection]] performs a scan, it often takes some time to enable a script containing an [[AOB Injection]]. In contrast, [[Code Injection]]-based scripts can always be enabled instantly because the injection address is known.
  
 
[[AOB Injection]] has a few benefits over [[Code Injection]] however:
 
[[AOB Injection]] has a few benefits over [[Code Injection]] however:

Revision as of 14:12, 22 November 2018

Code injection is the act of injecting code and causing it to be executed, either automatically (with the CreateRemoteThread Windows function) or by jumping to there from the target process after modifying the code.

There are multiple ways of injecting code into a target process. The most common methods are DLL injection and assembly injection.

One use of code injection is for finding dynamic addresses that tend to change each time the game is run. By placing a code injection on a routine that accesses that address, like a user interface update routine, you can find the address of that specific variable.

CE supports AOB Injection and Code Injection in AA (auto-assemble) scripts. AOB Injection and Code Injection are really the same thing except in case of AOB Injection, the injection point is scanned and found in the code using a specific signature (AOB = array of byte) while Code Injection uses hard-coded addresses. Since AOB Injection performs a scan, it often takes some time to enable a script containing an AOB Injection. In contrast, Code Injection-based scripts can always be enabled instantly because the injection address is known.

AOB Injection has a few benefits over Code Injection however:

  • The signature can be found in never builds of executables, too, making scripts more tolerant to software updates.
  • If the signature is not found during an AOB Injection (for example, because software was updated), then the script terminates (as opposed to Code Injection which would write the specified code to the wrong addresses anyway).

CE also supports building custom injection templates. mgr.inz.Player came up with a great set of extensions and added user-defined templates as well at this location: Custom 'AOB Injection' Templates. Make use of them, these will save you a lot of time.