Is there a way to check if the debugger is currently attached?

I am developing a visual studio plugin, and I need to check if a debugger (i.e. the application is currently) connected so that the user does not perform certain actions. I looked online, but I could not find anything useful.

Is there any way to do this?

Thanks!

EDIT: It seems the question is not clear enough. I am trying to achieve: my plugin works inside the visual studio. I need to check if this instance of visual studio is connected to the debugging application, so my plugin can act accordingly.

+4
source share
4 answers

Found: use the DTE2.Debugger property, and CurrentMode . That way you can say that you are currently debugging something or not.

+2
source

BOOL WINAPI IsDebuggerPresent (void)

or

BOOL WINAPI CheckRemoteDebuggerPresent (__ in HANDLE hProcess, __inout PBOOL pbDebuggerPresent)

from the plugin

IDebugEngine2 :: EnumPrograms

0
source

You do not indicate which language you are using, but here is how to do it in C #

if(Debugger.IsAttached) { // Do something } 
0
source

to prevent the user from performing certain actions

There are many ways to check the debugger, but it looks like you want to implement a debugger check to protect your software.

Debugging - you can prevent it with anti-debugging, but then your user can use anti-debugging depending on what you are doing. and so on. You will be at the short end of this chain, because you need to send the application, and user can get around all your mess that you introduced.

Here are some of the ressources if you still want to go that way. But please do not believe that your application will not be debugged because of this!

http://www.symantec.com/connect/articles/windows-anti-debug-reference http://old.honeynet.org/scans/scan33/nico/

0
source

Source: https://habr.com/ru/post/1479744/


All Articles