mirror of
https://github.com/HighCapable/YukiHookAPI.git
synced 2025-09-04 17:55:24 +08:00
Fix an hardcore bug
This commit is contained in:
@@ -240,7 +240,11 @@ fun loadApp(name: String, hooker: YukiBaseHooker)
|
||||
|
||||
`name` 为 APP 的包名,后方的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
|
||||
|
||||
装载并 Hook 指定、全部包名的 APP,若要 Hook 系统框架,请使用 `loadZygote`。
|
||||
装载并 Hook 指定、全部包名的 APP。
|
||||
|
||||
若要装载 APP Zygote 事件,请使用 `loadZygote`。
|
||||
|
||||
若要 Hook 系统框架,请使用 `loadSystem`。
|
||||
|
||||
### loadZygote [method]
|
||||
|
||||
@@ -258,6 +262,26 @@ fun loadZygote(hooker: YukiBaseHooker)
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 装载 APP Zygote 事件。
|
||||
|
||||
方法中的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
|
||||
|
||||
### loadSystem [method]
|
||||
|
||||
```kotlin
|
||||
inline fun loadSystem(initiate: PackageParam.() -> Unit)
|
||||
```
|
||||
|
||||
```kotlin
|
||||
fun loadSystem(hooker: YukiBaseHooker)
|
||||
```
|
||||
|
||||
**变更记录**
|
||||
|
||||
`v1.0.82` `新增`
|
||||
|
||||
**功能描述**
|
||||
|
||||
> 装载并 Hook 系统框架。
|
||||
|
||||
方法中的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
|
||||
|
@@ -201,7 +201,7 @@ encase {
|
||||
}
|
||||
```
|
||||
|
||||
你还可以同时使用 `loadZygote` 方法来装载系统框架。
|
||||
你还可以同时使用 `loadZygote` 方法来装载新的进程被 fork 后的第一个事件 `initZygote`。
|
||||
|
||||
> 示例如下
|
||||
|
||||
|
@@ -192,11 +192,11 @@ TestClass.hook {
|
||||
}
|
||||
```
|
||||
|
||||
### Hook 系统框架
|
||||
### Hook Zygote
|
||||
|
||||
在 `YukiHookAPI` 中,Hook 系统框架的实现非常简单。
|
||||
在 APP 启动时,新的进程被 fork 后的第一个事件 `initZygote`。
|
||||
|
||||
假设我们要全局 Hook 一个 `Activity` 的 `onCreate` 事件
|
||||
假设我们要全局 Hook 一个 APP `Activity` 的 `onCreate` 事件
|
||||
|
||||
在 `encase` 方法体中添加代码。
|
||||
|
||||
@@ -221,7 +221,34 @@ loadZygote {
|
||||
|
||||
这样就实现了上述的 Hook 功能。
|
||||
|
||||
!> `loadZygote` 与 `loadApp(name = "android")` 有直接性区别,`loadZygote` 会在 `initZygote` 中装载,若要 Hook 系统框架,建议使用 `loadZygote`。
|
||||
### Hook 系统框架
|
||||
|
||||
在 `YukiHookAPI` 中,Hook 系统框架的实现非常简单。
|
||||
|
||||
假设我们要全局 Hook 一个系统 `Activity` 的 `onCreate` 事件
|
||||
|
||||
在 `encase` 方法体中添加代码。
|
||||
|
||||
> 示例如下
|
||||
|
||||
```kotlin
|
||||
loadSystem {
|
||||
ActivityClass.hook {
|
||||
injectMember {
|
||||
method {
|
||||
name = "onCreate"
|
||||
param(BundleClass)
|
||||
returnType = UnitType
|
||||
}
|
||||
afterHook {
|
||||
// Your code here.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
!> `loadZygote` 与 `loadSystem` 有直接性区别,`loadZygote` 会在 `initZygote` 中装载,系统框架被视为一个单独的 APP 而存在,若要 Hook 系统框架,请使用 `loadSystem`。
|
||||
|
||||
### Hook Resources
|
||||
|
||||
|
Reference in New Issue
Block a user