title: SetSecurityInfo fails for PROCESS_TERMINATE
body: <p>I am trying to set security of PROCESS_TERMINATE. This is the code:</p>
  
  <pre><code>   CreateProcess("C:\\ADP\\SQLBase\\dbntsrv.exe", NULL, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, "C:\\ADP\\SQLBase", &amp;si, &amp;pi);       
  
  if(SetSecurityInfo(pi.hProcess, SE_KERNEL_OBJECT, PROCESS_TERMINATE, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
  {
      MessageBox(NULL, "process_terminate granted", NULL, MB_OK);
  }
  else
  {
      MessageBox(NULL, "process_terminate not granted", NULL, MB_OK);
  }
  
  
  
                      //--------------------- Permission to query for info to use GetExitCode -------------------------
  if(SetSecurityInfo(pi.hProcess, SE_KERNEL_OBJECT, PROCESS_QUERY_INFORMATION, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
  {
      MessageBox(NULL, "process_query_information granted", NULL, MB_OK);
  }
  else
  {
      MessageBox(NULL, "process_query_information not granted", NULL, MB_OK);
  }
  
  
  LPDWORD lpExitCode;
  GetExitCodeProcess(pi.hProcess, lpExitCode);
  </code></pre>
  
  <p>Here SetSecurityInfo for for PROCESS_TERMINATE fails and I get an <code>Unhandled Exception..(KERNEL32.dll):Access Violation</code> for </p>
  
  <pre><code>GetExitCodeProcess(pi.hProcess, lpExitCode);
  </code></pre>
  
  <p>Why does this happen? Thank You</p>