开发者

allow debugger to hook instance of application launched externally?

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 appea开发者_StackOverflowrs.

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)?


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 Link for an example. Or the MSDN documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜