首页 > 解决方案 > 无法再使用 vsjitdebugger 在启动时调试进程

问题描述

当我在 Windows 10 之前的 Windows 版本中工作时,我能够在启动特定可执行文件时调用调试器。为此,我创建了以下批处理文件:

@echo off
 >%temp%\output.reg echo Windows Registry Editor Version 5.00
>>%temp%\output.reg echo+
>>%temp%\output.reg echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\regsvr32.exe]
>>%temp%\output.reg echo "debugger"="vsjitdebugger.exe"
regedit /s %temp%\output.reg
del %temp\output.reg

为了阻止它,我使用了:

@echo off
 >%temp%\output.reg echo Windows Registry Editor Version 5.00
>>%temp%\output.reg echo+
>>%temp%\output.reg echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\regsvr32.exe]
>>%temp%\output.reg echo "debugger"=-
regedit /s %temp%\output.reg
del %temp\output.reg

当然,这些文件专门用于regsvr32.exe. 我还有其他可执行文件。

但是,在 Windows 10 下使用此技巧时,它无法正常工作。我会得到错误:

启动 'regsvr32 "my.dll"' 时出错:

未通知 Visual Studio 即时调试器应用程序已正确启动。

查看文档索引以获取“即时调试、错误”以获取更多信息。

我不知道它指的是什么文档索引,但我认为这是一些权限问题,所以我尝试将vsjitdebugger.exe文件上的设置更改Run this program as an administrator为 ,我得到一个不同的错误对话框,上面写着:

C:\WINDOWS\system32\regsvr32.exe

请求的操作需要提升。

现在,如果我要打开管理员 cmd 窗口并使用以下命令:

vsjitdebugger.exe regsvr32  "my.dll"

这确实会在应用程序启动时调用调试器regsvr32.exe。但是,这个技巧的重点是确保在执行应用程序时调用调试器,这可能不在我控制的 cmd 进程下。

所以我有2个问题。

  1. 有谁知道错误消息中提到的文档索引?
  2. 如何让它在 Windows 10 版本 1709(操作系统内部版本 16299.371)下工作?

标签: windowsdebuggingwindows-10

解决方案


我遇到过同样的问题。不知道为什么,但显然在 Windows 10 上,必须在注册表中配置一些东西,据我记得以前没有必要,或者可能在安装 Visual Studio 时自动发生。

它在“故障排除”下提到:https ://docs.microsoft.com/en-us/visualstudio/debugger/debug-using-the-just-in-time-debugger#jit_errors

The fix is to add a DWORD Value of Auto, with Value data of 1, to the following registry keys:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug

(For 64-bit machines): HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug

推荐阅读