libmem.h) and a modern C++ API (libmem.hpp) with support for C++20 features like std::optional and type-safe wrappers.
Installation
Using CMake (Recommended)
Add the following to yourCMakeLists.txt to fetch and configure libmem:
Using vcpkg
Manual Installation
- Windows
- Linux
- FreeBSD
Prerequisites:
- Windows SDK (Windows 7 or Windows 10/11)
- Visual Studio 2022 (with C++ and CMake support)
- Python 3
- Git Bash
Header Files
- C
- C++
lm_bool_tfor return values (LM_TRUE/LM_FALSE)- Structs like
lm_process_t,lm_module_t,lm_address_t - Output parameters (pointers) for results
- Manual memory management
Linking
- CMake
- GCC/Clang
- MSVC
Platform-Specific Dependencies
Windows:user32.lib,psapi.lib,ntdll.lib,shell32.lib
-ldl,-lstdc++,-lm
-ldl,-lkvm,-lprocstat,-lelf,-lstdc++,-lm
Basic Usage
- C
- C++
| Function | Description | Return Value |
|---|---|---|
LM_FindProcess(name, &proc) | Find process by name | lm_bool_t |
LM_FindModule(name, &mod) | Find module by name | lm_bool_t |
LM_ReadMemory(src, dest, size) | Read memory | bytes read |
LM_WriteMemory(dest, src, size) | Write memory | bytes written |
LM_SigScan(sig, addr, size) | Scan for signature | lm_address_t |
LM_HookCode(from, to, &tramp) | Hook function | hook size |
Complete Example
- C - Function Hooking
- C++ - Disassembly
Type Reference
- C Types
- C++ Types
Core Types:Structures:Constants:
See Also
- API Reference - Complete API documentation
- Rust Bindings - Rust language bindings
- Python Bindings - Python language bindings