title: createprocess suspended by default
body: <p>I have this function inside a dll:</p>
  
  <pre><code>int createChildProcess()
  {
      STARTUPINFO si;
      PROCESS_INFORMATION pi;
      int res;
  
      si.cb=sizeof(STARTUPINFO);
  
      STARTUPINFO* ptr=&amp;si;
      if(!CreateProcess(L"c:\\windows\\notepad.exe", NULL, 0, 0, false, CREATE_NEW_CONSOLE, 0, 0, &amp;si, &amp;pi))
      {
          mylog &lt;&lt; "CreateProcess error: " &lt;&lt; GetLastError() &lt;&lt; std::endl;
          res = 0;
      }
      else
          res = pi.dwProcessId;
  
      CloseHandle( pi.hProcess );
      CloseHandle( pi.hThread );
  
      return res;
  }
  </code></pre>
  
  <p>And i found 2 problems:</p>
  
  <p>1) The first time the function is called, return always error code 87 (The parameter is incorrect.).</p>
  
  <p>2) The second time, the function works, but creates a child process in suspended status and the cpu usage in the father process goes to 100%.</p>
  
  <p>Im testing with winXP sp3, and my dll was compiled in vs 2010.</p>
  
  <p>any help?</p>