Lua:fullAccess

From Cheat Engine
Jump to navigation Jump to search

<> Lua API Reference

function fullAccess(address, size) : void

Changes the protection of a memory block to writable and executable.

This is useful when a memory region needs to be modified or used for executable code.

Function Parameters

Parameter Type Description
address Integer / String The start address of the memory block whose protection should be changed.
size Integer The size, in bytes, of the memory block.

Returns

This function does not return a value.

Examples

Make a memory region writable and executable

1 local address = getAddress("game.exe+1234")
2 local size = 4096
3 fullAccess(address, size)

Use fullAccess before writing bytes

1 local address = getAddress("game.exe+1234")
2 
3 fullAccess(address, 16)
4 
5 writeBytes(address, 0x90, 0x90, 0x90, 0x90)

Use fullAccess with a symbol

1 fullAccess("SomeSymbol", 32)
2 
3 writeInteger("SomeSymbol", 100)

Make allocated memory executable

1 local cave = allocateMemory(1024)
2 
3 fullAccess(cave, 1024)
4 
5 writeBytes(cave, 0xC3)

Protect a region before assembling code

1 local address = getAddress("game.exe+5000")
2 
3 fullAccess(address, 128)
4 
5 autoAssemble([[
6 game.exe+5000:
7   nop
8   nop
9 ]])

Guard against unresolved addresses

1 local address = getAddressSafe("OptionalSymbol")
2 
3 if address ~= nil then
4   fullAccess(address, 64)
5 else
6   print("Address could not be resolved")
7 end

Use with a calculated address range

1 local base = getAddress("game.exe")
2 local offset = 0x1234
3 local size = 0x100
4 
5 fullAccess(base + offset, size)

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Sections / Views

Memory Mapping

Memory Copy / Compare

Memory Streams