void GetRemovableDrives (std::vector<std::wstring>& logicalDrives)
{
TCHAR buf[512];
TCHAR* rootPathName = buf;
BOOL hasVolumeInfo;
UINT driveType;
if (0==GetLogicalDriveStrings (512-1, buf))
return;
do
{
driveType = GetDriveType (rootPathName);
hasVolumeInfo = GetVolumeInformation (rootPathName,
NULL, 0,
NULL, NULL, NULL,
NULL, 0);
if (driveType==DRIVE_REMOVABLE && hasVolumeInfo==TRUE)
{
logicalDrives.push_back (std::wstring (rootPathName) );
}
while (*rootPathName++);
} while (*rootPathName);
}