I am writing my own applications to practice reversing. I want to be able to detect debuggers and change the execution in response.
When building the application, I am easily able to detect it is being debugged with
System.Diagnostics.Debugger.IsAttached
or kernel32.dll's CheckRemoteDebuggerPresent
method.
if (System.Diagnostics.Debugger.IsAttached)
{
//code if being debugged
}
When I debug my release in x64dbg though, the debugger is not detected. Is there a way to detect this?