LSPlt  LSPosed Developers
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 
9 namespace lsplt {
10 inline namespace v2 {
11 
15 struct MapInfo {
17  uintptr_t start;
19  uintptr_t end;
24  uint8_t perms;
26  bool is_private;
28  uintptr_t offset;
32  dev_t dev;
34  ino_t inode;
37 
42  [[maybe_unused, gnu::visibility("default")]] static std::vector<MapInfo> Scan(std::string_view pid = "self");
43 };
44 
67 [[maybe_unused, gnu::visibility("default")]] bool RegisterHook(dev_t dev, ino_t inode, std::string_view symbol,
68  void *callback, void **backup);
69 
103 [[maybe_unused, gnu::visibility("default")]] bool RegisterHook(dev_t dev, ino_t inode, uintptr_t offset,
104  size_t size, std::string_view symbol,
105  void *callback, void **backup);
113 [[maybe_unused, gnu::visibility("default")]] bool CommitHook();
114 
125 [[maybe_unused, gnu::visibility("default")]] bool InvalidateBackup();
126 } // namespace v2
127 } // 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:15
uintptr_t start
The start address of the memory region.
Definition: lsplt.hpp:17
bool is_private
Whether the memory region is private.
Definition: lsplt.hpp:26
uintptr_t end
The end address of the memory region.
Definition: lsplt.hpp:19
uint8_t perms
The permissions of the memory region. This is a bit mask of the following values:
Definition: lsplt.hpp:24
ino_t inode
The inode number of the memory region.
Definition: lsplt.hpp:34
uintptr_t offset
The offset of the memory region.
Definition: lsplt.hpp:28
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:32
std::string path
The path of the memory region.
Definition: lsplt.hpp:36
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 ...