LSPlt LSPosed Developers
Loading...
Searching...
No Matches
lsplt.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <sys/types.h>
4
5#include <string>
6#include <string_view>
7#include <vector>
8
10namespace lsplt {
11inline namespace v2 {
12
16struct MapInfo {
18 uintptr_t start;
20 uintptr_t end;
25 uint8_t perms;
29 uintptr_t offset;
33 dev_t dev;
35 ino_t inode;
38
43 [[maybe_unused, gnu::visibility("default")]] static std::vector<MapInfo> Scan(std::string_view pid = "self");
44};
45
68[[maybe_unused, gnu::visibility("default")]] bool RegisterHook(dev_t dev, ino_t inode, std::string_view symbol,
69 void *callback, void **backup);
70
104[[maybe_unused, gnu::visibility("default")]] bool RegisterHook(dev_t dev, ino_t inode, uintptr_t offset,
105 size_t size, std::string_view symbol,
106 void *callback, void **backup);
114[[maybe_unused, gnu::visibility("default")]] bool CommitHook();
115
126[[maybe_unused, gnu::visibility("default")]] bool InvalidateBackup();
127} // namespace v2
128} // namespace lsplt
bool CommitHook()
Commit all registered hooks.
bool InvalidateBackup()
Invalidate backup memory regions Normally LSPlt will backup the hooked memory region and do hook on a...
bool RegisterHook(dev_t dev, ino_t inode, std::string_view symbol, void *callback, void **backup)
Register a hook to a function by inode. For so within an archive, you should use #RegisterHook(ino_t,...
An entry that describes a line in /proc/self/maps. You can obtain a list of these entries by calling ...
Definition lsplt.hpp:16
uintptr_t start
The start address of the memory region.
Definition lsplt.hpp:18
bool is_private
Whether the memory region is private.
Definition lsplt.hpp:27
uintptr_t end
The end address of the memory region.
Definition lsplt.hpp:20
uint8_t perms
The permissions of the memory region. This is a bit mask of the following values:
Definition lsplt.hpp:25
ino_t inode
The inode number of the memory region.
Definition lsplt.hpp:35
uintptr_t offset
The offset of the memory region.
Definition lsplt.hpp:29
static std::vector< MapInfo > Scan(std::string_view pid="self")
Scans /proc/self/maps and returns a list of MapInfo entries. This is useful to find out the inode of ...
dev_t dev
The device number of the memory region. Major can be obtained by #major() Minor can be obtained by #m...
Definition lsplt.hpp:33
std::string path
The path of the memory region.
Definition lsplt.hpp:37