Difference between revisions of "Auto Assembler:globalAlloc"
Jump to navigation
Jump to search
(→See also) |
|||
Line 1: | Line 1: | ||
[[Category:Assembler]] | [[Category:Assembler]] | ||
− | '''Auto Assembler''' globalAlloc(''Symbol'', ''Size'') | + | '''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. | ||
=== Command Parameters === | === Command Parameters === | ||
Line 19: | 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 24: | 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) | ||
Revision as of 13:21, 3 October 2018
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
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
globalAlloc(SomeSymbol, 0x4)
globalAlloc(SomeSymbol, 0x4, SomeAOBSymbol)
globalAlloc(SomeSymbol, 0x1000, Tutorial-x86_64.exe)
globalAlloc(SomeSymbol, $1000, Tutorial-x86_64.exe)