title: WMI win32_physicalmedia or win32_diskdrive result prob
body: <p>I'm using visual c++ 2010.</p>
  
  <p>Im trying to retrieve harddisk serial number using win32_physicalmedia or win32_diskdrive and it's working normally but on alot of pcs it displays the serial number more than once and sometimes with symbols and characters.</p>
  
  <p>The code i'm using is as follow :</p>
  
  <pre><code>pSvc-&gt;ExecQuery(
  bstr_t("WQL"), 
  bstr_t("SELECT SerialNumber FROM Win32_PhysicalMedia"), // or Win32_DiskDrive
  WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, 
  NULL,
  &amp;pEnumerator);
  
   IWbemClassObject *pclsObj;
  ULONG uReturn = 0;
  
  while (pEnumerator)
  {
  HRESULT hr = pEnumerator-&gt;Next(WBEM_INFINITE, 1, 
      &amp;pclsObj, &amp;uReturn);
  
  if(0 == uReturn)
  {
      break;
  }
  
  VARIANT vtProp;
  
  hr = pclsObj-&gt;Get(L"SerialNumber", 0, &amp;vtProp, 0, 0);
      wcout &lt;&lt; " Physical Drive SN : " &lt;&lt; vtProp.bstrVal &lt;&lt; endl;
      VariantClear(&amp;vtProp);
  
      pclsObj-&gt;Release();
  }
  </code></pre>
  
  <p>The result is sometimes like this :<br>
  Physical Drive SN : 325a323565222565226500<br>
  Physical Drive SN : 325a323565222565226500<br>
  Physical Drive SN : 3<br>
  Physical Drive SN : 3<br>
  Physical Drive SN : 3<br>
  Physical Drive SN : ♥<br>
  Physical Drive SN : ♥        </p>
  
  <p>As you can see the serial is correct but it's repeated twice in 2nd line and the other lines are showing symbols knowing that i have only 1 Hard Disk.</p>
  
  <p>Please advise.</p>