Exemple #1
0
        private void _TopApply()
        {
            if (_TopDetour != null)
            {
                return;
            }

            // GetNativeStart to prevent managed backups.
            _TopDetour = new NativeDetour(Method.GetNativeStart(), Target.GetNativeStart());
        }
Exemple #2
0
        private void _TopUndo()
        {
            if (_TopDetour == null)
            {
                return;
            }

            _TopDetour.Undo();
            _TopDetour.Free();
            _TopDetour = null;
        }
        internal bool RegisterNativeDetour(NativeDetour _detour, MethodBase method, IntPtr from, IntPtr to)
        {
            Assembly owner = GetHookOwner();

            if (owner == null)
            {
                return(true); // continue with default detour creation, we just don't track it
            }
            OnNativeDetour?.Invoke(owner, method, from, to);
            TrackDetour(owner, _detour);
            return(true);
        }