API Categories
The libmem API is organized into the following categories:Process APIs
Enumerate, find, and manage processes on the system
Thread APIs
Enumerate and retrieve information about process threads
Module APIs
Load, unload, find, and enumerate modules in processes
Symbol APIs
Find and enumerate symbols in modules with demangling support
Memory Segment APIs
Enumerate and find memory segments in process address space
Memory APIs
Read, write, allocate, protect, and manage memory
Scanning APIs
Search memory for patterns, signatures, and data
Assembler APIs
Assemble and disassemble instructions for multiple architectures
Hooking APIs
Hook and unhook functions with code detours and VMT hooks
Naming Conventions
“Ex” Suffix ConventionAPIs with the “Ex” suffix operate on external processes (cross-process operations). APIs without the suffix operate on the current process.For example:
LM_ReadMemory()reads memory from the current processLM_ReadMemoryEx()reads memory from a specified external process
Function Patterns
All libmem functions follow these patterns:- Prefix: All functions start with
LM_ - Naming: Functions use PascalCase (e.g.,
LM_FindProcess,LM_EnumModules) - External Operations: Functions with
Exsuffix require alm_process_t *processparameter as the first argument - Callbacks: Enumeration functions take callback functions that return
LM_TRUEto continue orLM_FALSEto stop
Type Conventions
All libmem types follow these patterns:- Prefix: All types start with
lm_ - Naming: Types use snake_case and end with
_t(e.g.,lm_process_t,lm_module_t) - Consistency: The same types are used across both internal and external operations
Return Values
Most libmem functions follow these return conventions:- Boolean Operations: Return
LM_TRUEon success,LM_FALSEon failure - Address Operations: Return a valid address on success,
LM_ADDRESS_BADon failure - Size Operations: Return the size/count on success,
0on failure - Pointer Operations: Return a valid pointer on success,
NULLon failure
Getting Started
To get started with the libmem API:- Choose the category that matches your use case
- Review the available functions in that category
- Check whether you need the internal or external (
Ex) version - Refer to the detailed documentation for parameter and return value information