title: CreateProcess with DEBUG_PROCESS flag causes error 50 on some executables
body: <p>I am trying to write small debugger. My simplified code is </p>
  
  <pre><code>STARTUPINFOA sui;
  ZeroMemory( &amp;sui, sizeof(sui) );
  sui.cb = sizeof(sui);
  PROCESS_INFORMATION pi;
  ZeroMemory( &amp;pi, sizeof(pi) );
  
  DWORD dwFlags = DEBUG_PROCESS;
  string program = "program.exe";
  if (! CreateProcessA(NULL, (char*) program.c_str(), NULL, NULL, TRUE, dwFlags, NULL, NULL, &amp;sui, &amp;pi))
      printf("%s failed. LastError = %d", program.c_str(), GetLastError());
  </code></pre>
  
  <p>On large amount of executables it works fine.</p>
  
  <p>But on for example on C#-compiled executables this piece of code outputs "program.exe failed. LastError = 50". Error 50 is ERROR_NOT_SUPPORTED (<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx</a>). What can be a reason of this? How I can debug all kind of binaries?</p>