Launch external application from C++ program and attach it to visual 2008 debugger while debugging host in WinAPI
Posted
by
PiotrK
on Stack Overflow
See other posts from Stack Overflow
or by PiotrK
Published on 2011-02-18T23:00:02Z
Indexed on
2011/02/18
23:25 UTC
Read the original article
Hit count: 260
Basically I have Host and Child program. I do not have sources for Child so I can't change anything in it. I want to launch Host from debugger, which at some point should launch Child program. I want to attach Child automatically for debugging session as well (so any breakpoints set in DLL sources loaded under Child process will hit).
How to do this in Visual Studio 2008 C++ with standard WinAPI?
I tried this:
SHELLEXECUTEINFO sei = {0};
sei.cbSize = sizeof (SHELLEXECUTEINFO);
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.lpVerb = "open";
sei.lpFile = "Child.exe";
sei.lpParameters = "/Param";
sei.nShow = SW_SHOWNORMAL;
if (ShellExecuteEx (&sei))
{
WaitForSingleObject (sei.hProcess, INFINITE);
}
But this does not attach debugger for Child.exe
© Stack Overflow or respective owner