I am trying to get all the physical drives available on local machine.
I tried to use GetLogicalDrives()
but when i'm using this function it gets me also drives that physically not available on the machine, for example floppy drive A.
Here is my code:
void FindDrives()
{
DWORD drives = GetLogicalDrives();
for (int i=0; i<26; i++)
{
if( ( drives & ( 1 << i ) ) )
{
wchar_t driveName[] = { L'A' + i, L':', L'\\', L'\0'};
std::wcout << driveName << std::endl;
}
}
}
How can I get only physically available drives?