Utilities
utils/plat.h
Platform abstraction utilities and module helpers.
Provides:
- Cross-platform calling conventions
- Module representation (base, size)
- Memory patching utilities
Used internally by address/pattern systems.
Header source2mod/utils/plat.h
Section
Represents a section of a loaded module.
Used for:
- Pattern scanning in specific sections
- Memory analysis
Fields
| Field | Type | Description |
|---|---|---|
m_szName | std::string | Section name (e.g. ".text", ".data") |
m_pBase | void* | Pointer to section base |
m_iSize | size_t | Section size in bytes |
Module
Represents a loaded module (library).
Used for:
- Pattern scanning
- Address resolution
Fields
| Field | Type | Description |
|---|---|---|
pHandle | void* | Handle to loaded module (Linux) |
pBase | uint8_t* | Base address of module |
nSize | unsigned int | Module size in bytes |
Functions
Plat_WriteMemory
void Plat_WriteMemory(void* pPatchAddress, uint8_t* pPatch, int iPatchSize);Writes raw memory to a given address.
Typically used for: * Patching instructions * Hooking functions
This modifies process memory directly. Use with caution.
| Parameter | Type | Description |
|---|---|---|
pPatchAddress | void* | Destination address |
pPatch | uint8_t* | Pointer to data |
iPatchSize | int | Size in bytes |
Macros
FASTCALL
#define FASTCALL __fastcallFastcall convention (Windows)
THISCALL
#define THISCALL __thiscallThiscall convention (Windows)
FASTCALL
#define FASTCALLFastcall not used on Linux
THISCALL
#define THISCALLThiscall not used on Linux
strtok_s
#define strtok_s strtok_rSecure strtok alternative
MODULE_PREFIX
#define MODULE_PREFIX ""Windows module prefix
MODULE_EXT
#define MODULE_EXT ".dll"Windows module extension
MODULE_PREFIX
#define MODULE_PREFIX "lib"Linux module prefix
MODULE_EXT
#define MODULE_EXT ".so"Linux module extension