Difference between revisions of "Lua:Class:RIPRelativeScanner"

From Cheat Engine
Jump to navigation Jump to search
(Initial page creation.)
 
m (Examples: Syntax Highlight.)
Line 72: Line 72:
  
 
===Examples===
 
===Examples===
<pre>
+
<syntaxhighlight lang="lua" line>
 
local scanner = createRipRelativeScanner("game.exe")
 
local scanner = createRipRelativeScanner("game.exe")
  
Line 80: Line 80:
 
   print(string.format("%X", scanner.Address[i]))
 
   print(string.format("%X", scanner.Address[i]))
 
end
 
end
</pre>
+
</syntaxhighlight>
  
<pre>
+
<syntaxhighlight lang="lua" line>
 
local startAddress = getAddress("game.exe")
 
local startAddress = getAddress("game.exe")
 
local stopAddress = startAddress + getModuleSize("game.exe")
 
local stopAddress = startAddress + getModuleSize("game.exe")
Line 93: Line 93:
 
   print(string.format("%X", scanner.Address[i]))
 
   print(string.format("%X", scanner.Address[i]))
 
end
 
end
</pre>
+
</syntaxhighlight>
  
 
{{LuaSeeAlso}}
 
{{LuaSeeAlso}}

Revision as of 00:07, 27 June 2026

<> Lua API Reference

class RIPRelativeScanner : Object

The RIPRelativeScanner class scans a memory range or module for RIP-relative instructions.

A RIPRelativeScanner inherits from Object. It can be used to find instructions that contain RIP-relative addresses. The resulting addresses point to the RIP-relative offset inside the instruction.

Inheritance

Class Inherits From Description
RIPRelativeScanner Object Scans a memory range or module for RIP-relative instructions.

Creation

<> Lua API Reference

function createRipRelativeScanner(startaddress, stopaddress, includejumpsandcalls) : RIPRelativeScanner

<> Lua API Reference

function createRipRelativeScanner(modulename, includejumpsandcalls) : RIPRelativeScanner

Creates a RIP-relative scanner.

When a start and stop address are provided, the scanner scans the specified address range. When a module name is provided, the scanner scans the specified module.

The includejumpsandcalls parameter controls whether RIP-relative jumps and calls are included in the results.

Function Parameters

Parameter Type Description
startaddress Integer or CEAddressString The start address of the memory range to scan.
stopaddress Integer or CEAddressString The stop address of the memory range to scan.
modulename String The name of the module to scan.
includejumpsandcalls Boolean (optional) If true, RIP-relative jumps and calls are included in the scan results.

Returns

RIPRelativeScanner — The created RIPRelativeScanner object.

Properties

Property Type Description
Count Integer The number of instructions found that have a RIP-relative address.
Address[] Integer An array used to access the results. Each entry is the address of the RIP-relative offset inside the instruction.

Methods

This class has no documented methods.

Examples

1 local scanner = createRipRelativeScanner("game.exe")
2 
3 print("RIP-relative instruction count: " .. tostring(scanner.Count))
4 
5 for i = 0, scanner.Count - 1 do
6   print(string.format("%X", scanner.Address[i]))
7 end
 1 local startAddress = getAddress("game.exe")
 2 local stopAddress = startAddress + getModuleSize("game.exe")
 3 
 4 local scanner = createRipRelativeScanner(startAddress, stopAddress, true)
 5 
 6 print("RIP-relative instruction count: " .. tostring(scanner.Count))
 7 
 8 for i = 0, math.min(scanner.Count - 1, 9) do
 9   print(string.format("%X", scanner.Address[i]))
10 end

Main Pages

Core Lua documentation entry points

Lua
Script Engine