The Image File Execution setting in registry is mostly used to attach debugger to a process. It is mainly used for debugging services. A normal use case is to attach a debugger when a service or process starts up. In such a case when you cannot control the service\process startup e.g. through commandline then you can use the Image File Execution option. With this option you specify that when a particular exe e.g. myapp.exe is executed then the call should come to your application first (which normally is a debugger) and your application or debugger can then execute the original application with required paramaters.
Reference: How to: Launch the Debugger Automatically
Reference: How to: Launch the Debugger Automatically
Sometimes, you may need to debug the
startup code for an application that is launched by another process.
Examples include services and custom setup actions. In these scenarios,
you can have the debugger launch and automatically attach when your
application starts.
To setup an application to launch the debugger automatically
- Start the Registry Editor (regedit).
- In the Registry Editor, open the HKEY_LOCAL_MACHINE folder.
- Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\currentversion\image file execution options.
- In the Image File Execution Options folder, locate the name of the application you want to debug, such as myapp.exe. If you cannot find the application you want to debug:
- Right-click the Image File Execution Options folder, and on the shortcut menu, click New Key.
- Right-click the new key, and on the shortcut menu, click Rename.
- Edit the key name to the name of your application; myapp.exe, in this example.
- Right-click the myapp.exe folder, and on the shortcut menu, click New String Value.
- Right-click the new string value, and on the shortcut menu, click Rename.
- Change the name to debugger.
- Right-click the new string value, and on the shortcut menu, click Modify.
The Edit String dialog box appears. - In the Value data box, type vsjitdebugger.exe.
- Click OK.
- From the Registry menu, click Exit.
- The directory containing vsjitdebugger.exe must be in your system path. To add it to the system path, follow these steps:
- Open the Control Panel in Classic view, and double-click System.
- Click Advanced System Settings.
- In System Properties, click the Advanced tab.
- On the Advanced tab, click Environment Variables.
- In the Environment Variables dialog box, under System variables, select Path, then click the Edit button.
- In the Edit System Variable dialog box, add the directory to the Variable value text box. Use a semicolon to separate it from other entries in the list.
- Click OK to close the Edit System Variable dialog box.
- Click OK to close the Environment Variables dialog box.
- Click OK to close the System Properties dialog box.