无法解析符号'有完整的参考
本文关键字:参考 符号 | 更新日期: 2023-09-27 18:13:26
我尝试检测调试器,我得到错误"无法解析符号'Dte'",即使有envdte引用。谷歌什么都没给我。谢谢你。
using EnvDTE;
namespace test
{
static class Program
{
[STAThread]
static void Main()
{
foreach (EnvDTE.Process p in Dte.Debugger.DebuggedProcesses) {
if (p.ProcessID == spawnedProcess.Id) {
}
}
}
}
}
我需要检测附加的调试器(如Ollydbg)
要检查进程是否附加了调试器,可以使用:
- CheckRemoteDebuggerPresent
- 调试器。蝾螈
如何检查是否附加调试器
-
CheckRemoteDebuggerPresent适用于任何正在运行的进程,并检测本机调试器
-
调试器。IsAttached只适用于当前进程,并且只检测托管调试器。例如,OllyDbg不会被检测到。
代码:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
public class DetectDebugger
{
[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("Debugger Attached: " + isDebuggerPresent);
Console.ReadLine();
}
}
c#是区分大小写的语言。
是DTE
(大写)而不是Dte
。文档:https://msdn.microsoft.com/en-us/library/envdte.dte.aspx