title: How to find Windows service by PID and thread ID?
body: <p>In my C# application I have a PID and threadID of a Windows service. How can I find which service it is (note: e.g., a single instance of svchost.exe can host multiple services)? Either directly in C# or calling some other utility is fine with me.</p>
  
  <p>Process Hacker can show the service name (properties of process -> tab threads -> column service).</p>
  
  <p>So far I have found the process and also the thread:</p>
  
  <pre><code>var p = Process.GetProcessById(pid);
  var t = p.Threads.Cast&lt;ProcessThread&gt;().SingleOrDefault(t =&gt; t.Id == threadId);
  </code></pre>
  
  <p>How to go on? Alternatives?</p>