Is there a way to determine if the attached debugger is a remote debugger?
1 answer
You can use your own CheckRemoteDebuggerPresent
fromkernel32.dll
From MSDN :
"remote" in CheckRemoteDebuggerPresent does not mean that the debugger is necessarily on another computer; instead, indicates that the debugger is in a separate and parallel process.
You can use it like this:
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool CheckRemoteDebuggerPresent(IntPtr hProcess, ref bool isDebuggerPresent);
public static void Main()
{
bool isDebuggerPresent = false;
CheckRemoteDebuggerPresent(Process.GetCurrentProcess().Handle, ref isDebuggerPresent);
Console.WriteLine(string.Format("Debugger Attached: {0}", isDebuggerPresent));
Console.ReadLine();
}
+3
source to share