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

FieldTypeDescription
m_szNamestd::stringSection name (e.g. ".text", ".data")
m_pBasevoid*Pointer to section base
m_iSizesize_tSection size in bytes

Module

Represents a loaded module (library).

Used for:

  • Pattern scanning
  • Address resolution

Fields

FieldTypeDescription
pHandlevoid*Handle to loaded module (Linux)
pBaseuint8_t*Base address of module
nSizeunsigned intModule 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.
ParameterTypeDescription
pPatchAddressvoid*Destination address
pPatchuint8_t*Pointer to data
iPatchSizeintSize in bytes

Macros

FASTCALL

#define FASTCALL __fastcall

Fastcall convention (Windows)

THISCALL

#define THISCALL __thiscall

Thiscall convention (Windows)

FASTCALL

#define FASTCALL

Fastcall not used on Linux

THISCALL

#define THISCALL

Thiscall not used on Linux

strtok_s

#define strtok_s strtok_r

Secure 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

On this page