title: Trying to get the Active cores,confused with the usage of GetLogicalProcessorInformationEx Winapi
body: <pre><code>LOGICAL_PROCESSOR_RELATIONSHIP Relationship = {};
  SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *m_pinfoBase = nullptr;
  SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *m_pinfoCurrent = nullptr;
  DWORD m_cbRemaining = 0;
  DWORD cb = 0;
  
  m_pinfoBase =reinterpret_cast&lt;SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *&gt;(LocalAlloc(LMEM_FIXED, cb));
  
  if (!GetLogicalProcessorInformationEx(Relationship,
      m_pinfoBase, &amp;cb))
  {
      printf("Error 1 %d\n",GetLastError());
      //return;
  }
  else
  {
      printf("ActiveCores:%d\n", m_pinfoBase-&gt;Group.GroupInfo-&gt;ActiveProcessorCount);
  }
  </code></pre>
  
  <p>I looked up the documentation in, <a href="https://blogs.msdn.microsoft.com/oldnewthing/20131028-00/?p=2823" rel="nofollow noreferrer">usage details of the api</a>, also I looked up SO and other links and I wrote a small snippet to fetch the Active cores and the api GetLogicalProcessorInformationEx is returning ERROR_INSUFFICIENT_BUFFER. I have two questions, </p>
  
  <ol>
  <li>The proper ActiveProcessorCount in the _PROCESSOR_GROUP_INFO structures gives the count of Active i.e unparked cores?</li>
  <li>What's wrong in my code snippe</li>
  </ol>