inject_process
Inject a runtime probe into a running game process to unlock online tools like runtime_*, hook_*, and drain_events. Automatically switches session context when the target belongs to another game.
Instructions
把运行时探针注入正在运行的游戏进程。目标换了游戏时会把会话身份与索引一起换过去,并在返回里给 context_switched。
注入后才能使用 runtime_* / hook_* / drain_events 等在线工具。 同一个进程只会注入一次(重复调用会复用,不会重复 Hook)。
会话上下文会自动跟随目标:注入的进程若属于另一个游戏,会话身份
(game_dir / engine / metadata_path)与静态索引会一起切过去,返回里给
context_switched 说明换了哪个游戏。为什么必须切:否则 search_*(旧游戏)
与 runtime_*(新游戏)属于两个游戏,token 对账这把「尺子」本身就是错的。
反推不出目标属于哪个游戏时不猜,改用 context_warning 如实提示。
权限:不需要管理员。实测(2026-10)普通用户权限注入 IL2CPP 游戏
成功(本进程与游戏进程的完整性级别都是 Medium,attach 后取运行时、
枚举实例都正常)。唯一要匹配的是权限级:游戏若以管理员身份运行
(完整性级别 High),普通权限的 Agent 才注入不进去。
游戏带反调试 / 反注入时也会失败 —— 那是保护机制,不是权限问题。
Args: pid: 目标进程号。留空则自动找当前游戏的主程序。 auto_find: 没给 pid 时是否自动查找。 preferred_module: IL2CPP 模块名,默认自动识别 (GameAssembly.dll / libil2cpp.so)。
Returns: {ok, pid, init: {module, base, api_available, api_missing, fallbacks}, context_switched?, context_warning?}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pid | No | ||
| auto_find | No | ||
| preferred_module | No |