コード例 #1
0
        public bool IsEnabled(DbgNativeFunctionHookContext context)
        {
            if (!debuggerSettings.AntiIsDebuggerPresent)
            {
                return(false);
            }

            return(CorDebugUtils.TryGetInternalRuntime(context.Process, out _));
        }
コード例 #2
0
        public void Hook(DbgNativeFunctionHookContext context, out string?errorMessage)
        {
            if (!CorDebugUtils.TryGetInternalRuntime(context.Process, out var runtime))
            {
                errorMessage = "Couldn't find CorDebug runtime";
                return;
            }

            switch (context.Process.Architecture)
            {
            case DbgArchitecture.X86:
                HookX86(context, runtime, out errorMessage);
                break;

            case DbgArchitecture.X64:
                HookX64(context, runtime, out errorMessage);
                break;

            default:
                Debug.Fail($"Unsupported architecture: {context.Process.Architecture}");
                errorMessage = $"Unsupported architecture: {context.Process.Architecture}";
                break;
            }
        }