Weird issue when launching processes.

  • Thread starter Thread starter MacScotsman
  • Start date Start date
M

MacScotsman

I'm responsible for a piece of a launching app of a larger piece of
legacy software. My app is the starting point for the client side.
Running my application (VC++) kicks off a few self terminating process
to check file versions, etc... and finally launches a seperate
application (outside my control) and closes itself. This second
application then launches a third. This 3rd app launches a 16 bit app
to access data. The third app also launches a seperate 16 bit app
which needs to use the first 16 bit app to access data as well.

My problem is that when I run my app, the 2 16 bit apps down launch
under the same instance of NTVDM for the first attempt only. Once the
app is shut down, all subsequent attempts will launch the 16 bit apps
under seperate NTVDMs, causing the application to hang.

If I run the 2nd app in the chain directly, it works correctly
everytime. Presumably, I'm launching the 2nd app incorrectly from the
my application, but I can't figure out what the issue could be.

I'm currently using the following code to launch the 2nd app.

STARTUPINFOW si = { sizeof si };
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = show_cmd;
if (!::CreateProcessW(
app_name,
const_cast<wchar_t*>(cmd_line),
NULL,
NULL,
TRUE,
0,
NULL,
NULL,
&si,
&m_pi))
{
std::ostringstream os;
os << "Could not create process \"" << app_name << "\": ";
throw OS::Error(os.str(), ::GetLastError());
}

I'd appreciate any help anyone could provide (or at least a direction
to go in)... I've tried a number of things, but I'm not really a C++
developer, so my kung-fu is not that string. :)
 
Back
Top