MonoHook
MonoHook copied to clipboard
hook C# method at runtime without modify dll file (such as UnityEditor.dll), works on Windows, Mac, Android il2cpp(armv7a and armv8a)
报错信息是:error: 'pthread_jit_write_protect_np' is unavailable: not available on iOS
unity 2021.3.x unity2022.3.x启动界面就崩溃 unity2020正常 Begin MonoManager ReloadAssembly Native extension for UWP target not found Native extension for WindowsStandalone target not found Native extension for iOS target not found Native extension...
目前使用上来,hook一些多重载的方法的时候会有些麻烦,所以才有意搞了这个类 举个例子,下面只需要传入 hook的类型和方法名,则可自动搜索需要hook的目标类型与当前类型中的方法,两者方法签名一致的就会自动hook住 ``` [InitializeOnLoad] public class LogFilter { static QuickHook hook; static LogFilter() { hook = new QuickHook(typeof(LogFilter)); hook.HookMethod(Debug.unityLogger.GetType(), "Log"); hook.HookMethod(Debug.unityLogger.GetType(), "LogFormat"); } [MethodImpl(MethodImplOptions.NoOptimization)] static void Log(ILogger logger, LogType...
跑test会在2019/2020崩溃,2021正常
``` LDR x17, #0x8 BR x17 addr ``` 这里使用x16 x17 x18都可,前2个状态寄存器,后1个平台寄存器。在标准的情况下,arm64下几乎不会使用它们。它们完全可以随意使用,仅手写asm的情况下才会被占用
需求场景: 有一个函数A:输出A 需要在程序运行时:替换函数A的输出内容 输出B 然后在执行函数A 再输出B **目前实现方式**:遍历函数A的参数 属性 返回值等 写入cs代码文件中重新编译 然后进行HOOK **理想实现方式**:遍历函数A的参数 属性 返回值等 创建一个动态函数 作为绑定代理 然后进行HOOK
unity版本:2022.3.8f1c1 ymbol file LoadedFromMemory is not a mono symbol file - Loaded All Assemblies, in 1.888 seconds Refreshing native plugins compatible for Editor in 44.14 ms, found 15 plugins. Preloading...
 > long addrOffset = Math.Abs(_targetPtr.ToInt64() - _proxyPtr.ToInt64()); 这里的`_proxyPtr`似乎应该改为`_replacementPtr` 