private HookHandle AddInternal(MemoryHookType type, MemoryHookCallback callback, ulong begin, ulong end, object userToken)
        {
            var wrapper = new uc_cb_hookmem((uc, _type, addr, size, value, user_data) =>
            {
                Debug.Assert(uc == Emulator.Handle);
                callback(Emulator, (MemoryType)_type, addr, size, value, userToken);
            });

            return(Add((UnicornHookType)type, wrapper, begin, end));
        }
Esempio n. 2
0
        private HookHandle AddInternal(MemoryHookType type, MemoryHookCallback callback, ulong begin, ulong end, object userToken)
        {
            var wrapper = new uc_cb_hookmem((uc, _type, addr, size, value, user_data) =>
            {
                Debug.Assert(uc == Emulator.Bindings.UCHandle);
                callback(Emulator, (MemoryType)_type, addr, size, value, userToken);
            });

            var ptr = Marshal.GetFunctionPointerForDelegate(wrapper);

            return(Add((Bindings.HookType)type, ptr, begin, end));
        }