Ejemplo n.º 1
0
        private void HookStateChangedHandler(Hook hook, IRunningProcess aProcess, eNktHookState previousState, eNktHookState currentState)
        {
            var aStateChangeInfo = new HookStateChangeInfo(hook, aProcess, previousState, currentState);

            var aHook = aStateChangeInfo.Hook;

            if (aStateChangeInfo.CurrentState == eNktHookState.stRemoved)
            {
                _view.RemoveHook(aHook);
                _view.RemoveHookEnabled     = false;
                _view.RemoveAllHooksEnabled = _spyManager.AtLeastOneHookWasCreated;
                _view.ExportHookingSettings = _spyManager.AtLeastOneHookWasCreated;
            }
            else
            {
                _view.DisplayHookStatus(aStateChangeInfo);
            }

            if (!aProcess.IsHooked())
            {
                _view.DisplayRecentlyUnhookedProcess(aProcess);
            }
            else if (aProcess.AtLeastOneHookIsActive())
            {
                _view.DisplayRecentlyHookedProcessAsActive(aProcess);
            }
            else
            {
                _view.DisplayRecentlyHookedProcessAsInactive(aProcess);
            }

            _view.RefreshModulesView();
        }