Magisk/native/jni/zygisk/inject.hpp

30 lines
722 B
C++
Raw Normal View History

#pragma once
#include <stdint.h>
2021-01-08 05:25:44 -08:00
#include <jni.h>
#define INJECT_ENV_1 "MAGISK_INJ_1"
#define INJECT_ENV_2 "MAGISK_INJ_2"
2021-08-18 03:44:32 -07:00
enum : int {
ZYGISK_SETUP,
2021-08-19 04:55:17 -07:00
ZYGISK_CHECK_DENYLIST,
ZYGISK_UNMOUNT,
2021-08-21 03:52:59 -07:00
ZYGISK_GET_LOG_PIPE,
2021-08-18 03:44:32 -07:00
};
// Unmap all pages matching the name
void unmap_all(const char *name);
2021-08-11 00:00:21 -07:00
// Get library name + offset (from start of ELF), given function address
uintptr_t get_function_off(int pid, uintptr_t addr, char *lib);
2021-08-11 00:00:21 -07:00
// Get function address, given library name + offset
uintptr_t get_function_addr(int pid, const char *lib, uintptr_t off);
2021-01-08 00:53:24 -08:00
void self_unload();
void hook_functions();
bool unhook_functions();
2021-08-19 04:55:17 -07:00
bool remote_check_denylist(int uid, const char *process);
int remote_request_unmount();