[英]Cannot resolve symbol 'Dte' with envdte reference
我嘗試檢測調試器,即使使用envdte引用,也出現錯誤“無法解析符號'Dte'”。 谷歌什么也沒給我。 謝謝。
using EnvDTE;
namespace test
{
static class Program
{
[STAThread]
static void Main()
{
foreach (EnvDTE.Process p in Dte.Debugger.DebuggedProcesses) {
if (p.ProcessID == spawnedProcess.Id) {
}
}
}
}
}
C#是區分大小寫的語言。
它的DTE
(大寫)不是Dte
。 https://msdn.microsoft.com/zh-cn/library/envdte.dte.aspx上的文檔
我需要檢測是否連接了調試器(例如Ollydbg)
要檢查該進程是否連接了調試器,可以使用:
如何檢查是否連接了調試器
CheckRemoteDebuggerPresent適用於任何正在運行的進程,也可以檢測本機調試器。
Debugger.IsAttached僅適用於當前進程,並且僅檢測托管調試器。 舉例來說, this不會檢測到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();
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.