title: Different disk serial number result from GetVolumeInformation()
body: <pre><code>DWORD disk_serialINT[MAX_PATH + 1];
  GetVolumeInformationA(NULL, NULL, NULL, disk_serialINT, NULL, NULL, NULL, NULL);
  char* disk_serialANSI;
  sprintf(disk_serialANSI, "%d", disk_serialINT);
  std::string HDDserial = disk_serialANSI;
  </code></pre>
  
  <p>This is my piece of code where I get the hdd serial number, but the problem is that every time when the program executes the value is different. Can someone explain that?</p>
  
  <p>SOLVED:</p>
  
  <pre><code>DWORD disk_serialINT;
  GetVolumeInformationA(NULL, NULL, NULL, &amp;disk_serialINT, NULL, NULL, NULL, NULL);
  std::string HDDserial = std::to_string(disk_serialINT);
  </code></pre>
  
  <p>Thanks.</p>