1

I am working on a school project, I wanted to know if it is possible to detect if the program is loaded into the Visual Studio debugger, and if it is possible, I want to close the debugger and the app.

Is there a way to do that ? Thanks !

tankyx
  • 87
  • 1
  • 10
  • It is generally considered a bad idea to make program behavior change depending on whether a debugger is attached, because it makes debugging the program much harder. That said, you can use `IsDebuggerPresent`. – Raymond Chen Apr 05 '16 at 06:20

1 Answers1

1

The simple way is calling IsDebuggerPresent() and then exit the application if it returned true. This may be enough for a first try.

However, it mainly depends on how good someone is with debugging. A good developer / malware analyst may easily work around such a trick.

You may want to look at What is your favourite anti-debugging trick? here on SO for other ideas.

Community
  • 1
  • 1
Thomas Weller
  • 55,411
  • 20
  • 125
  • 222