I\'m trying to have Windows automatically start the debugger when an application is launched (as described in msdn) however I\'m getting the following error:
So after looking around for the solution to this problem I found the answer here. The issue for me was that the debugger registry hives weren't set properly. This is prolly due to missing the Auto
entry, though I'm not positive. I didn't have this issue before I upgraded to Windows 10. The registry entries need to be:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]
"Auto"="1"
"Debugger"="\"C:\\WINDOWS\\system32\\vsjitdebugger.exe\" -p %ld -e %ld"
"UserDebuggerHotKey"=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug]
"Auto"="1"
"Debugger"="\"C:\\WINDOWS\\system32\\vsjitdebugger.exe\" -p %ld -e %ld"
"UserDebuggerHotKey"=dword:00000000
To disable JIT debugging use:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]
"Auto"="1"
"Debugger"=-
"UserDebuggerHotKey"=-
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug]
"Auto"="1"
"Debugger"=-
"UserDebuggerHotKey"=-
Just a FYI, I wrote a simple cmd script to enable/disable on a per executable name basis. I'm posting it here for you convenience:
@echo off
if %1.==. goto help
if %1==/internal goto apply
if %1==/d (
%0 /internal %2 -
) else (
%0 /internal %1 "vsjitdebugger.exe"
)
goto help
:apply
shift
>%temp%\output.reg echo Windows Registry Editor Version 5.00
>>%temp%\output.reg echo+
if %2 == - (
: Delete registry key
>>%temp%\output.reg echo [-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\%~1]
) else (
: Add registry key
>>%temp%\output.reg echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\%~1]
>>%temp%\output.reg echo "debugger"=%2
)
:In case you want to see what it is importing, uncomment the following 3 lines
:echo %temp%\output.reg
:echo --------------------
:type %temp%\output.reg
regedit /s %temp%\output.reg
del %temp%\output.reg
goto :eof
:help
echo %0 [/d] ^
echo.
echo Allows you to attach a debugger as soon as the process executes anywhere in the
echo system. If /d switch is provided, then delete the registry key to stop this
echo behaviour.
Because of the use of %0
, you can name it whatever you want (with an .cmd
or .bat
extension) and it will still work as expected.