wrapped_chunkClass
A template class for creating a chunk of memory with customizable padding. More...
Public Functions
Type | Name |
---|---|
constexpr | wrapped_chunk (typename id< U >::type start, typename id< U >::type content, typename id< U >::type end) |
constexpr | wrapped_chunk (const uint8_t(&start)[start_padding], const uint8_t(&content)[content_size], const uint8_t(&end)[end_padding]) |
constexpr uintptr_t | operator[] (size_t idx) const |
void | initialize () const |
Protected Properties
Type | Name |
---|---|
uint8_t | start_ [start_padding] |
uint8_t | body_ [content_size] |
uint8_t | end_ [end_padding] |
Private Functions
Type | Name |
---|---|
constexpr | wrapped_chunk (const uint8_t *start, const uint8_t *content, const uint8_t *end, std::index_sequence< Lstart_size... >, std::index_sequence< Lcontent_size... >, std::index_sequence< Lend_size... >) |
Detailed Description
The wrapped_chunk
class template is designed to create a memory block that includes padding at both the start and end, surrounding a central content area. This structure is useful in scenarios where memory needs to be obfuscated, protected, or organized in a specific way, such as in security-sensitive applications. The class provides multiple constructors to initialize the memory block with either arrays or initializer lists.
Template Parameters
start_padding
: The number of bytes to pad at the beginning of the chunk.end_padding
: The number of bytes to pad at the end of the chunk.content_size
: The size of the content area inside the chunk.
Public Functions
constexpr wrapped_chunk (typename id< U >::type start, typename id< U >::type content, typename id< U >::type end)
Constructs a wrapped_chunk
object using initializer lists.
Definition
constexpr libantispy::wrapped_chunk< start_padding, end_padding, content_size >::wrapped_chunk
Detailed Description
This constructor allows the creation of a wrapped_chunk
object using initializer lists for the start padding, content, and end padding segments. It provides flexibility in initializing the memory block with specific values.
Template Parameters
U
: The type of the initializer lists (default isstd::initializer_list<uint8_t>
).
Parameters
start
: The initializer list for the start padding.content
: The initializer list for the content.end
: The initializer list for the end padding.
constexpr wrapped_chunk (const uint8_t(&start)[start_padding], const uint8_t(&content)[content_size], const uint8_t(&end)[end_padding])
Constructs a wrapped_chunk
object using arrays.
Definition
constexpr libantispy::wrapped_chunk< start_padding, end_padding, content_size >::wrapped_chunk
Detailed Description
This constructor allows the creation of a wrapped_chunk
object using arrays for the start padding, content, and end padding segments. This method provides a way to initialize the memory block with arrays of fixed size.
Parameters
start
: The array for the start padding.content
: The array for the content.end
: The array for the end padding.
constexpr uintptr_t operator[] (size_t idx) const
Index operator to access the content.
Definition
constexpr uintptr_t
Detailed Description
This operator allows access to the content of the wrapped_chunk
object by index. It returns the address of the content at the specified index, which can be useful for manipulating or inspecting specific parts of the content.
Parameters
idx
: The index of the content to access.
Returns
The address of the content at the specified index.
void initialize () const
Initializes the wrapped_chunk
object.
Definition
void
Detailed Description
This method initializes the wrapped_chunk
object by calling functions at the start and end addresses. This can be useful for setting up memory or running specific operations when the chunk is first created.
Protected Properties
uint8_t start_ [start_padding]
Array for the start padding.
Definition
uint8_t libantispy::wrapped_chunk< start_padding, end_padding, content_size >::start_
Detailed Description
This array holds the padding bytes at the start of the chunk. The size of this array is defined by the start_padding
template parameter. The start padding provides a buffer zone before the content data, which can be used for security or alignment purposes.
uint8_t body_ [content_size]
Array for the content.
Definition
uint8_t libantispy::wrapped_chunk< start_padding, end_padding, content_size >::body_
Detailed Description
This array holds the actual content data of the chunk. The size of this array is specified by the content_size
template parameter. The content is protected by the start and end padding.
uint8_t end_ [end_padding]
Array for the end padding.
Definition
uint8_t libantispy::wrapped_chunk< start_padding, end_padding, content_size >::end_
Detailed Description
This array holds the padding bytes at the end of the chunk. The size of this array is defined by the end_padding
template parameter. The end padding provides a buffer zone after the content data, which can be used for security, alignment, or obfuscation purposes.
Private Functions
constexpr wrapped_chunk (const uint8_t *start, const uint8_t *content, const uint8_t *end, std::index_sequence< Lstart_size... >, std::index_sequence< Lcontent_size... >, std::index_sequence< Lend_size... >)
Constructs a wrapped_chunk
object using pointers and index sequences.
Definition
constexpr libantispy::wrapped_chunk< start_padding, end_padding, content_size >::wrapped_chunk
Detailed Description
This private constructor initializes the wrapped_chunk
object using pointers to the start padding, content, and end padding segments, along with index sequences that define the layout of each segment. This constructor is used internally by the other constructors to set up the chunk with the correct data.
Parameters
start
: The pointer to the start padding.content
: The pointer to the content.end
: The pointer to the end padding.
Template Parameters
Lstart_size
: The index sequence for the start padding.Lcontent_size
: The index sequence for the content.Lend_size
: The index sequence for the end padding.