Re: CreateProcess in a loop

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I reviewed the problem and narrowed down the issue. The first time
loop is executed, process is created succesfully. However, the second
time around, CreateProcess fails. GetLastError() reports
ERROR_SUCCESS or 0.

STARTUPINFO si;
PROCESS_INFORMATION pi;
int i = 0;
while ( i < 6 )
{
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );

CreateProcess(function arguments);
DWORD err = GetLastError();
WaitForSingleObject(some arguments);

CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
i++;
}

I turned on debugger and first time process is created fine. It
runs. When loops is executed second time things go bad.

si = {cb=68 lpReserved=0x00000000 <Bad Ptr> lpDesktop=0x00000000 <Bad
Ptr> ...} . This is what VS2005 compiler reports during iterations.
Whats going on? The words "Bad Ptr" is raising an alarm. Need help.
I can provide more details if needed.

.



Relevant Pages

  • Son of Beast - 2008 - My Experience
    ... I rode the SOB for the first time in four years and obviously the ... first time since they removed the loop and changed the trains. ... roughest ride I have ever felt in my life (I thought the last time I ...
    (rec.roller-coaster)
  • Re: branch prediction optimization
    ... If you had a loop like ... head = NULL; ... although the first time through the loop will suffer. ... struct node *next; ...
    (comp.unix.programmer)
  • branch prediction optimization
    ... I guess some processors have special branch instructions where you can ... If you had a loop like ... tail = NULL; ... although the first time through the loop will suffer. ...
    (comp.unix.programmer)
  • Re: Crookshanks and Victor Krum, and Hermione
    ... without a time-turner and witnessed many things as a silent ... first time you read through it. ... some sort of weird loop that keeps going. ... selection to time travel. ...
    (alt.fan.harry-potter)
  • fgetcsv returns false in dynamic read vs. hard-coded read ??
    ... I am working with directories in PHP for the first time. ... that I've changed multiple times to try different things. ... displaying each file name and it can display the name, ... I've even tried setting a for loop and hard coding each file name ...
    (comp.lang.php)