title: Listing All Physical Drives (Windows)
body: <p>How can I get all the physical drive paths (\\.\PhysicalDriveX) on a Windows computer, with C/C++?</p>
  
  <p>The answers in <a href="https://stackoverflow.com/questions/327718/how-to-list-physical-disks">this</a> question suggest getting the logical drive letter, and then getting the physical drive corresponding to that mounted drive. The problem is, I want to get <em>all</em>
  physical drives connected to the computer, including drives that are not mounted.</p>
  
  <p>Other answers suggest incrementing a value from 0-15 and checking if a drive exists there (\\.\PhysicalDrive0, \\.\PhysicalDrive1, ...) or calling WMIC to list all the drives.[</p>
  
  <p>As these seem like they would work, they seem like they are not the best approach to be taking. Is there not a simple function such as <code>GetPhysicalDrives</code> that simply returns a vector of <code>std::string</code>'s containing the paths of all the physical drives?</p>