public bool IsEnabled(DbgNativeFunctionHookContext context) { if (!debuggerSettings.AntiIsDebuggerPresent) { return(false); } return(CorDebugUtils.TryGetInternalRuntime(context.Process, out _)); }
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; } }