Memory Library
¶
#include <std/mem.pat>
Types¶
Endian
¶
Endianess
Native
: Native endianess of the current systemBig
: Big endianessLittle
: Little endianess
Functions¶
std::mem::align_to(u128 alignment, u128 value) -> u128
¶
Aligns a given value upwards to the next valid value
Parameter |
Description |
---|---|
|
Alignment of new value |
|
Value to align |
|
Aligned value |
std::mem::base_address() -> u128
¶
Gets the current base address of the loaded data
Parameter |
Description |
---|---|
|
Current base address |
std::mem::size() -> u128
¶
Gets the size of the loaded data
Parameter |
Description |
---|---|
|
Size of the loaded data |
std::mem::find_sequence(u128 occurence_index, u8 bytes...) -> u128
¶
Searches the data for the “occurence_index”th occurence of a sequence of “bytes”
Parameter |
Description |
---|---|
|
Index of found sequence if there’s more than one. Zero yields the first one |
|
One or more bytes to search for |
|
Start address of the sequence |
std::mem::find_sequence_in_range(u128 occurence_index, u128 offsetFrom, u128 offsetTo, u8 bytes...) -> u128
1.16.0¶
Searches the data for the “occurence_index”th occurence of a sequence of “bytes” in a region spanning from “offsetFrom” to “offsetTo”
Parameter |
Description |
---|---|
|
Index of found sequence if there’s more than one. Zero yields the first one |
|
Address of where to start the search |
|
Address of where to end the search |
|
One or more bytes to search for |
|
Start address of the sequence |
std::mem::read_unsigned(u128 address, u128 size, Endian endian = Endian::Native) -> u128
¶
Reads an unsigned value from memory without declaring a variable
Parameter |
Description |
---|---|
|
Address of value to read |
|
Size of value to read. This can be 1, 2, 4, 8 or 16 |
|
Endianess of the read value v1.23.0 |
|
Value as the smalest unsigned type that can fit this many bytes |
std::mem::read_signed(u128 address, u128 size, Endian endian = Endian::Native) -> s128
¶
Reads an signed value from memory without declaring a variable
Parameter |
Description |
---|---|
|
Address of value to read |
|
Size of value to read. This can be 1, 2, 4, 8 or 16 |
|
Endianess of the read value v1.23.0 |
|
Value as the smalest signed type that can fit this many bytes |
std::mem::read_string(u128 address, u128 size) -> str
¶
Reads string from memory without declaring a variable
Parameter |
Description |
---|---|
|
Address of value to read |
|
Size of string to read |
|
String containing a trimmed version of the read string |
std::mem::eof() -> bool
1.11.0¶
Checks if the current offset is at or past the end of the data. Useful for letting an array grow until it encapsulates the entire data
Parameter |
Description |
---|---|
|
True if the current offset is at or past the end of the data |