plugify  1.0.0.0
Public Member Functions | List of all members
plugify::MemProtector Class Reference

A class to manage memory protection settings. More...

#include <mem_protector.hpp>

Public Member Functions

 MemProtector ()=delete
 
 MemProtector (MemAddr address, size_t length, ProtFlag prot, bool unsetOnDestroy=true)
 Constructs a MemProtector object to set memory protection. More...
 
 ~MemProtector ()
 Destructor to restore the original protection settings if required.
 
ProtFlag OriginalProt () const noexcept
 Gets the original protection settings. More...
 
bool IsValid () const noexcept
 Checks if the memory protection was successfully set. More...
 

Detailed Description

A class to manage memory protection settings.

This class allows setting and unsetting memory protection for a given memory region. It ensures that the original protection settings are restored when the object is destroyed.

Definition at line 17 of file mem_protector.hpp.

Constructor & Destructor Documentation

◆ MemProtector() [1/2]

plugify::MemProtector::MemProtector ( )
delete

Deleted default constructor.

◆ MemProtector() [2/2]

plugify::MemProtector::MemProtector ( MemAddr  address,
size_t  length,
ProtFlag  prot,
bool  unsetOnDestroy = true 
)

Constructs a MemProtector object to set memory protection.

Parameters
addressThe memory address to protect.
lengthThe length of the memory region to protect.
protThe protection flags to set.
unsetOnDestroyIf true, the original protection settings will be restored when the object is destroyed.

Member Function Documentation

◆ IsValid()

bool plugify::MemProtector::IsValid ( ) const
inlinenoexcept

Checks if the memory protection was successfully set.

Returns
True if the memory protection was successfully set, false otherwise.

Definition at line 48 of file mem_protector.hpp.

◆ OriginalProt()

ProtFlag plugify::MemProtector::OriginalProt ( ) const
inlinenoexcept

Gets the original protection settings.

Returns
The original protection flags.

Definition at line 41 of file mem_protector.hpp.


The documentation for this class was generated from the following file: