title: TerminateProcess() Fails when called upon a 32 bin application in a 64 bin machine
body: <p>Please go through below code:</p>
  
  <pre><code>LPSTR commandBuffer = "\"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\"";
  STARTUPINFO si;
  PROCESS_INFORMATION pi;
  ZeroMemory(&amp;si, sizeof(si));
  si.cb = sizeof(si);
  ZeroMemory(&amp;pi, sizeof(pi));
  si.dwFlags = STARTF_USESHOWWINDOW;
  si.wShowWindow = SW_MINIMIZE;
  if (CreateProcess(NULL,
      commandBuffer,
      NULL,
      NULL,
      FALSE,
      0,
      NULL,
      NULL,
      &amp;si,
      &amp;pi)) {
  
      Sleep(5000);
      UINT exitCode = 0;
      if (!TerminateProcess(pi.hProcess, exitCode))
          std::cout &lt;&lt; GetLastError() &lt;&lt; std::endl;
      CloseHandle(pi.hProcess);
      CloseHandle(pi.hThread);
  }
  </code></pre>
  
  <p>Here when I create a process with 32 bin application (Notepad++.exe) on a 64 bin Windows 7 machine <code>TerminateProcess()</code> fails with error code 5 (Access denied) but if I create a process with a 64 bit application (i.e. <code>LPSTR commandBuffer = "\"C:\\Program Files\\depends22_x64\\depends.exe\""</code>) on the same machine there is no error. I need to understand why this is happening and how can I be able to properly terminate a process created with 32 bit application on a 64 bit Windows 7 machine.</p>