Difference between revisions of "Auto Assembler:globalAlloc"

From Cheat Engine
Jump to navigation Jump to search
(Created page with ''''Auto Assembler''' globalAlloc(''Symbol'', ''Size'') Allocates a certain amount of memory and registers the specified name. Using GlobalAlloc in other scripts will then not a…')
 
(Undo revision 6593 by This content is not available (Talk))
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''Auto Assembler''' globalAlloc(''Symbol'', ''Size'')
+
[[Category:Assembler]]
 +
'''Auto Assembler''' globalAlloc(''Symbol'', ''Size'', ''AllocateNearThisAddress'' OPTIONAL)
  
 
Allocates a certain amount of memory and registers the specified name.  
 
Allocates a certain amount of memory and registers the specified name.  
 
Using GlobalAlloc in other scripts will then not allocate the memory again, but reuse the already existing memory.  
 
Using GlobalAlloc in other scripts will then not allocate the memory again, but reuse the already existing memory.  
 
(Or allocate it anyhow if found it wasn't allocated yet)
 
(Or allocate it anyhow if found it wasn't allocated yet)
 +
If 'AllocateNearThisAddress' is specified CE will try to allocate the memory near that address.
 +
This is useful for 64-bit targets where the jump distance could be bigger than 2GB otherwise.
  
=== Function Parameters ===
+
=== Command Parameters ===
 
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
 
{|width="85%" cellpadding="10%" cellpadding="5%" cellspacing="0" border="0"
 
!align="left"|Parameter
 
!align="left"|Parameter
Line 18: Line 21:
 
|integer
 
|integer
 
|The byte size of the memory block to allocate globally
 
|The byte size of the memory block to allocate globally
 +
|-
 +
|AllocateNearThisAddress
 +
|string
 +
|The address to allocate near if given
 
|}
 
|}
  
Line 23: Line 30:
 
== Examples ==
 
== Examples ==
 
  globalAlloc(SomeSymbol, 0x4)
 
  globalAlloc(SomeSymbol, 0x4)
 +
 +
globalAlloc(SomeSymbol, 0x4, SomeAOBSymbol)
 +
 +
globalAlloc(SomeSymbol, 0x1000, Tutorial-x86_64.exe)
 +
 +
globalAlloc(SomeSymbol, $1000, Tutorial-x86_64.exe)
  
  
 
== See also ==
 
== See also ==
 
* [[Cheat_Engine:Auto Assembler|Auto Assembler]]
 
* [[Cheat_Engine:Auto Assembler|Auto Assembler]]
 +
* [[Auto_Assembler:Commands|Auto Assembler Commands]]
  
=== Related Functions ===
+
=== Related Commands ===
 
* [[Auto Assembler:aobScan|aobScan]]
 
* [[Auto Assembler:aobScan|aobScan]]
 
* [[Auto Assembler:aobScanModule|aobScanModule]]
 
* [[Auto Assembler:aobScanModule|aobScanModule]]
Line 43: Line 57:
 
* [[Auto Assembler:registerSymbol|registerSymbol]]
 
* [[Auto Assembler:registerSymbol|registerSymbol]]
 
* [[Auto Assembler:unregisterSymbol|unregisterSymbol]]
 
* [[Auto Assembler:unregisterSymbol|unregisterSymbol]]
* [[Auto Assembler:LUA|LUA]]
+
* [[Auto Assembler:LUA ASM|LUA ASM]]
* [[Auto Assembler:ASM|ASM]]
 

Latest revision as of 18:46, 18 March 2019

Auto Assembler globalAlloc(Symbol, Size, AllocateNearThisAddress OPTIONAL)

Allocates a certain amount of memory and registers the specified name. Using GlobalAlloc in other scripts will then not allocate the memory again, but reuse the already existing memory. (Or allocate it anyhow if found it wasn't allocated yet) If 'AllocateNearThisAddress' is specified CE will try to allocate the memory near that address. This is useful for 64-bit targets where the jump distance could be bigger than 2GB otherwise.

Command Parameters[edit]

Parameter Type Description
Symbol string The symbol to allocate globally
Size integer The byte size of the memory block to allocate globally
AllocateNearThisAddress string The address to allocate near if given


Examples[edit]

globalAlloc(SomeSymbol, 0x4)
globalAlloc(SomeSymbol, 0x4, SomeAOBSymbol)
globalAlloc(SomeSymbol, 0x1000, Tutorial-x86_64.exe)
globalAlloc(SomeSymbol, $1000, Tutorial-x86_64.exe)


See also[edit]

Related Commands[edit]