forked from rovo89/Xposed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libxposed_common.h
59 lines (46 loc) · 2.75 KB
/
libxposed_common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef LIBXPOSED_COMMON_H_
#define LIBXPOSED_COMMON_H_
#include "xposed_shared.h"
#ifndef NATIVE_METHOD
#define NATIVE_METHOD(className, functionName, signature) \
{ #functionName, signature, reinterpret_cast<void*>(className ## _ ## functionName) }
#endif
#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
namespace xposed {
#define CLASS_XPOSED_BRIDGE "de/robv/android/xposed/XposedBridge"
#define CLASS_XRESOURCES "android/content/res/XResources"
#define CLASS_MIUI_RESOURCES "android/content/res/MiuiResources"
#define CLASS_ZYGOTE_SERVICE "de/robv/android/xposed/services/ZygoteService"
#define CLASS_FILE_RESULT "de/robv/android/xposed/services/FileResult"
/////////////////////////////////////////////////////////////////
// Provided by common part, used by runtime-specific implementation
/////////////////////////////////////////////////////////////////
extern jclass classXposedBridge;
extern jmethodID methodXposedBridgeHandleHookedMethod;
extern int readIntConfig(const char* fileName, int defaultValue);
extern void onVmCreatedCommon(JNIEnv* env);
/////////////////////////////////////////////////////////////////
// To be provided by runtime-specific implementation
/////////////////////////////////////////////////////////////////
extern "C" bool xposedInitLib(xposed::XposedShared* shared);
extern bool onVmCreated(JNIEnv* env);
extern void prepareSubclassReplacement(JNIEnv* env, jclass clazz);
extern void logExceptionStackTrace();
extern jint XposedBridge_getRuntime(JNIEnv* env, jclass clazz);
extern void XposedBridge_hookMethodNative(JNIEnv* env, jclass clazz, jobject reflectedMethodIndirect,
jobject declaredClassIndirect, jint slot, jobject additionalInfoIndirect);
extern void XposedBridge_setObjectClassNative(JNIEnv* env, jclass clazz, jobject objIndirect, jclass clzIndirect);
extern jobject XposedBridge_cloneToSubclassNative(JNIEnv* env, jclass clazz, jobject objIndirect, jclass clzIndirect);
extern void XposedBridge_dumpObjectNative(JNIEnv* env, jclass clazz, jobject objIndirect);
extern void XposedBridge_removeFinalFlagNative(JNIEnv* env, jclass clazz, jclass javaClazz);
#if PLATFORM_SDK_VERSION >= 21
extern jobject XposedBridge_invokeOriginalMethodNative(JNIEnv* env, jclass, jobject javaMethod, jint, jobjectArray,
jclass, jobject javaReceiver, jobjectArray javaArgs);
extern void XposedBridge_closeFilesBeforeForkNative(JNIEnv* env, jclass clazz);
extern void XposedBridge_reopenFilesAfterForkNative(JNIEnv* env, jclass clazz);
#endif
#if PLATFORM_SDK_VERSION >= 24
extern void XposedBridge_invalidateCallersNative(JNIEnv*, jclass, jobjectArray javaMethods);
#endif
} // namespace xposed
#endif // LIBXPOSED_COMMON_H_