title: Getting the number of handles to a specific process
body: <p>Not sure if it's possible to get such information, but i was messing with the WinAPI docs trying to figure out a way to get the number of opened handles to my process. First i created a console application that retrieves the number of handles the current process has, then i created another console app that gets a handle to the first app with an OpenProcess call. The code used in the first application is the following:</p>
  
  <pre><code>auto hProcess = GetCurrentProcess();
  while (true)
  {
      DWORD Handles = 0;
      if (GetProcessHandleCount(hProcess, &amp;Handles))
      {
          std::cout &lt;&lt; Handles &lt;&lt; '\n';
      }
      Sleep(2000);
  }
  </code></pre>
  
  <p>I was expecting the first application to print 1, but i got 50 when i ran in my Windows 10 PC, and 58 when i ran it with elevated privilegies. Also, when i ran the code above in a virtual machine with Windows 7, 11 handles were printed. What is going on?</p>