Lua:fullAccess
(Redirected from fullAccess)
Jump to navigation
Jump to search
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.
Contents
Function Parameters[edit]
| 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[edit]
This function does not return a value.
Examples[edit]
Make a memory region writable and executable[edit]
1 local address = getAddress("game.exe+1234")
2 local size = 4096
3 fullAccess(address, size)
Use fullAccess before writing bytes[edit]
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[edit]
1 fullAccess("SomeSymbol", 32)
2
3 writeInteger("SomeSymbol", 100)
Make allocated memory executable[edit]
1 local cave = allocateMemory(1024)
2
3 fullAccess(cave, 1024)
4
5 writeBytes(cave, 0xC3)
Protect a region before assembling code[edit]
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[edit]
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[edit]
1 local base = getAddress("game.exe")
2 local offset = 0x1234
3 local size = 0x100
4
5 fullAccess(base + offset, size)