Adr*_*ian 4 windows debugging windows-10
当我在 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
Run Code Online (Sandbox Code Playgroud)
为了阻止它,我使用了:
@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
Run Code Online (Sandbox Code Playgroud)
当然,这些文件专门用于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"
Run Code Online (Sandbox Code Playgroud)
这确实会在应用程序启动时调用调试器regsvr32.exe。然而,这个技巧的目的是确保在执行应用程序时调用调试器,该应用程序可能不在我控制的 cmd 进程下。
所以我有两个问题。
我遇到过同样的问题。不知道为什么,但显然在 Windows 10 上,有必要在注册表中配置某些内容,据我所知,以前不需要这样做,或者可能在安装 Visual Studio 时自动发生。
在“故障排除”下提到了这一点: https: //learn.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
Run Code Online (Sandbox Code Playgroud)