KittyMemoryEx 1.0.0
Dedicated library for runtime code patching, memory scanning, tracing, injection and some more useful memory utilities. works for both Android and Linux
Loading...
Searching...
No Matches
KittyPtrValidator Class Reference

Validates the memory access rights for a given address range. More...

#include <KittyPtrValidator.hpp>

Public Member Functions

 KittyPtrValidator (pid_t pid, bool use_cache)
 Constructs a KittyPtrValidator object with the specified process ID and whether to use a cache.
void setUseCache (bool use_cache)
 Sets whether to use cached region information.
void setPID (pid_t pid)
 Sets the process ID to query memory regions.
bool isPtrReadable (uintptr_t ptr, size_t len=sizeof(void *))
 Checks if a pointer is readable.
bool isPtrWritable (uintptr_t ptr, size_t len=sizeof(void *))
 Checks if a pointer is writable.
bool isPtrExecutable (uintptr_t ptr, size_t len=sizeof(void *))
 Checks if a pointer is executable.
bool isPtrInAddressSpace (uintptr_t ptr)
 Checks if a pointer is within the address space of the current process.
bool isPtrReadable (const void *ptr, size_t len=sizeof(void *))
bool isPtrWritable (const void *ptr, size_t len=sizeof(void *))
bool isPtrExecutable (const void *ptr, size_t len=sizeof(void *))
bool isPtrInAddressSpace (const void *ptr)
void clearCache ()
 Clears the cached region information.
void refreshRegionCache ()
 Refreshes the cached region information.
std::vector< RegionInfo > cachedRegions () const
 Retrieves the cached region information.

Detailed Description

Validates the memory access rights for a given address range.

This class uses process maps to determine the read, write, and execute permissions of a memory address.

Constructor & Destructor Documentation

◆ KittyPtrValidator()

KittyPtrValidator::KittyPtrValidator ( pid_t pid,
bool use_cache )
inline

Constructs a KittyPtrValidator object with the specified process ID and whether to use a cache.

Parameters
pidThe process ID.
use_cacheDetermines if the cache should be used.
Here is the call graph for this function:

Member Function Documentation

◆ cachedRegions()

std::vector< RegionInfo > KittyPtrValidator::cachedRegions ( ) const
inline

Retrieves the cached region information.

Returns
A vector of RegionInfo objects representing the cached regions.

◆ isPtrExecutable()

bool KittyPtrValidator::isPtrExecutable ( uintptr_t ptr,
size_t len = sizeof(void *) )

Checks if a pointer is executable.

Parameters
ptrThe memory address to check.
lenThe length of the memory range to check.
Returns
true if the memory address is executable, false otherwise.

◆ isPtrInAddressSpace()

bool KittyPtrValidator::isPtrInAddressSpace ( uintptr_t ptr)
inline

Checks if a pointer is within the address space of the current process.

Parameters
ptrThe memory address to check.
Returns
true if the pointer is within the address space, false otherwise.
Here is the call graph for this function:

◆ isPtrReadable()

bool KittyPtrValidator::isPtrReadable ( uintptr_t ptr,
size_t len = sizeof(void *) )

Checks if a pointer is readable.

Parameters
ptrThe memory address to check.
lenThe length of the memory range to check.
Returns
true if the memory address is readable, false otherwise.

◆ isPtrWritable()

bool KittyPtrValidator::isPtrWritable ( uintptr_t ptr,
size_t len = sizeof(void *) )

Checks if a pointer is writable.

Parameters
ptrThe memory address to check.
lenThe length of the memory range to check.
Returns
true if the memory address is writable, false otherwise.

◆ setPID()

void KittyPtrValidator::setPID ( pid_t pid)
inline

Sets the process ID to query memory regions.

Parameters
pidThe process ID to query.
Here is the call graph for this function:

◆ setUseCache()

void KittyPtrValidator::setUseCache ( bool use_cache)
inline

Sets whether to use cached region information.

Parameters
use_cacheTrue to use cached region information, false to clear the cache.
Here is the call graph for this function:

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