tags:

views:

27

answers:

1

I'm trying to test problems with an MFC application that still uses DDEEXEC mechanism for handling shell verbs (e.g. "open").

I cannot seem to find a way to cause the debugger to hook the application instance the second its created (or at a point of my choosing) when it's launched from the Windows shell. For example, if I were to double click on myfile.ext - which is mapped to use ddeexec [open("%1")] in our application, I cannot find a way to allow me to hook into our application's .exe during that initial invocation.

I can put: __asm int 3

In other code, and get the JIT debugger to ask if it should intercede on behalf of my app, but if I try to put that at the start of the program (say, in CMyWinApp::InitInstance), then no JIT dialog ever appears.

Does anyone have an idea for how to allow me to inject "start the debugger now" into my application (that doesn't initially run from the debugger)?

+2  A: 

Yes there is a way, Windows has something called Image File Execution Options that can be used to auto-attach a debugger. I've used to to debug services.

See http://blogs.msdn.com/b/greggm/archive/2005/02/21/377663.aspx for an example. Or the MSDN documentation.

shf301
Mordachai