Difference between revisions of "Lua:getHandleList"
Jump to navigation
Jump to search
(Created page with "Category:Lua {{CodeBox|'''function''' getHandleList(''filter'') ''':''' table}} Returns a table containing handles from the system. The optional ''filter'' parameter con...") |
m (Syntax Highlighting.) |
||
| Line 79: | Line 79: | ||
===Examples=== | ===Examples=== | ||
| − | < | + | <syntaxhighlight lang="lua" line> |
-- Get handles owned by the currently opened target process | -- Get handles owned by the currently opened target process | ||
local handles = getHandleList(1) | local handles = getHandleList(1) | ||
| Line 94: | Line 94: | ||
print("Granted access: " .. string.format("%X", handle.GrantedAccess)) | print("Granted access: " .. string.format("%X", handle.GrantedAccess)) | ||
end | end | ||
| − | </ | + | </syntaxhighlight> |
| − | < | + | <syntaxhighlight lang="lua" line> |
-- Get handles to the currently opened target process | -- Get handles to the currently opened target process | ||
local handles = getHandleList(2) | local handles = getHandleList(2) | ||
| Line 108: | Line 108: | ||
print("Handle: " .. string.format("%X", handle.HandleValue)) | print("Handle: " .. string.format("%X", handle.HandleValue)) | ||
end | end | ||
| − | </ | + | </syntaxhighlight> |
{{LuaSeeAlso}} | {{LuaSeeAlso}} | ||
Latest revision as of 20:56, 26 June 2026
Returns a table containing handles from the system.
The optional filter parameter controls which handles are returned. Each handle entry contains information such as the owning process ID, object type index, handle value, object address, and granted access rights.
Calling this function without a filter returns all handles in the system, which can be a very large amount of data.
Note: The Object field will be invalid when using the 32-bit version of Cheat Engine on a 64-bit Windows system.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| filter | Integer (optional) | Controls which handles are returned. 0 returns everything, 1 returns target process handles only, 2 returns handles to the target process, and 3 returns handles to the Cheat Engine process. |
Returns[edit]
table — A table containing handle entries.
Filter Values[edit]
| Value | Meaning | Description |
|---|---|---|
| 0 | Everything | Returns all handles in the system. This can return a very large amount of entries. |
| 1 | Target process handles only | Returns handles owned by the currently opened target process. |
| 2 | Handles to target process | Returns handles that point to the currently opened target process. |
| 3 | Handles to Cheat Engine process | Returns handles that point to the Cheat Engine process. |
Handle Entry Fields[edit]
| Field | Type | Description |
|---|---|---|
| ProcessID | Integer | The ID of the process that owns the handle. |
| ObjectTypeIndex | Integer | The object type index of the handle. |
| HandleAttributes | Integer | The attributes associated with the handle. |
| HandleValue | Integer | The numeric value of the handle. |
| Object | Integer | The object address associated with the handle. This field will be invalid when using 32-bit Cheat Engine on a 64-bit Windows system. |
| GrantedAccess | Integer | The granted access mask for the handle. |
Examples[edit]
1 -- Get handles owned by the currently opened target process
2 local handles = getHandleList(1)
3
4 print("Handle count: " .. tostring(#handles))
5
6 local maxResults = math.min(#handles, 10)
7
8 for i = 1, maxResults do
9 local handle = handles[i]
10
11 print("Process ID: " .. tostring(handle.ProcessID))
12 print("Handle: " .. string.format("%X", handle.HandleValue))
13 print("Granted access: " .. string.format("%X", handle.GrantedAccess))
14 end
1 -- Get handles to the currently opened target process
2 local handles = getHandleList(2)
3
4 print("Handle count: " .. tostring(#handles))
5
6 for i = 1, math.min(#handles, 10) do
7 local handle = handles[i]
8
9 print("Owner process ID: " .. tostring(handle.ProcessID))
10 print("Handle: " .. string.format("%X", handle.HandleValue))
11 end