title: Determining the parent process id from C#
body: <p>I would like to determine the process id of the parent process for an arbitrary process in Windows. </p>
  
  <p>I need this method to work on both x64 and x32. </p>
  
  <p>Any ideas / sample code to make this happen. System.Diagnositics.Process does not include this info. </p>
  
  <p>I am a bit worried about using the toolhelp apis cause they are 32 bit specific. </p>
  
  <p>Related info: </p>
  
  <ul>
  <li><a href="http://www.codeproject.com/KB/threads/ParentPID.aspx" rel="nofollow noreferrer">C++ implementation</a></li>
  <li><a href="http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=27395" rel="nofollow noreferrer">Some thing I googled</a> (the interop there is not x64 freindly) </li>
  </ul>
  
  <p>The Performance counter solution in <a href="http://msdn.microsoft.com/en-us/netframework/aa569609.aspx" rel="nofollow noreferrer">the FAQ</a>: 
  (PerformanceCounter("Process", "Creating Process ID", procName);)  scares me, cause it does not allow you to enter a process id, instead you specify a process by name so it all can go pear shape when you have multiple children. </p>