Under The Hood - Matt Pietrek

Debugging application startup when you don't directly launch the app

Out of the blue yesterday an internal MS architect called me in my office (which rarely happens.) They needed to debug a second instance of Windows Media Player which crashed when launched within Internet Explorer.  The good old "Attach to process" debugger trip wouldn't work, since Media Player faulted before they could attach to it.

Reaching way back into my bag of tricks, I recalled the "Image File Execution Options" trick. By setting a registry key, you can cause Windows to launch a different executable than the original program. In this case, you tell Windows to start the debugger of your choice, with the name of the original executable passed as an argument to the debugger.

This trick is mainly used for debugging services, but comes in handy in other cases as well. After a day of fighting the version control system and test scripts, it sure felt good to have done at least one useful thing.

Published Thursday, August 12, 2004 12:42 PM by Matt Pietrek

Comments

 

NUnitAddin said:

August 12, 2004 1:45 PM
 

Michael Geary said:

This is a great tip, thanks Matt!

I wonder which process handle gets passed back to the app that called CreateProcess? The debugger or the target app? Hopefully the target app. The MSDN article doesn't say.
August 13, 2004 3:29 AM
 

NUnitAddin said:

August 14, 2004 7:29 PM
 

notgartner.com: Mitch Denny's Blog said:

August 15, 2004 1:20 AM
 

John said:

My favorite use for this is sysinternals.com replacing task manager with process explorer.
August 16, 2004 3:20 PM
 

TrackBack said:

Alexis Smirnov Weblog :: Windows Image File Execution Options
August 23, 2004 11:30 AM
 

Sergio said:

September 24, 2004 11:08 AM
 

Actors and Actresses » Archive du blog » Yves Dolce said:

January 4, 2008 1:02 AM
 

Dinner and a Movie » Under The Hood - Matt Pietrek : Debugging application startup when you … said:

March 20, 2008 3:27 PM
 

Debugging a Process Launch « Tweaker said:

March 9, 2009 4:26 AM
New Comments to this post are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker