#include
#include
#include
#include
using std::cout;
using std::endl;
int _tmain(int argc, _TCHAR* argv[])
{
DWORD logicalDrive = GetLogicalDrives();
CString debugStr;
char drive='A';
for (int i=1, drive='A'; drive<='Z'; i = i<<1, ++drive)
{
if (logicalDrive & i)
{
debugStr.Format(L"%c exists", drive);
cout << debugStr ;
debugStr.Format(L"%c:", drive);
switch( GetDriveType(debugStr.GetBuffer(0)) )
{
case DRIVE_UNKNOWN:
cout << "DRIVE_UNKNOWN" << endl;
break;
case DRIVE_NO_ROOT_DIR:
cout << "DRIVE_NO_ROOT_DIR" << endl;
break;
case DRIVE_REMOVABLE:
cout << "DRIVE_REMOVABLE" << endl;
break;
case DRIVE_FIXED:
cout << "DRIVE_FIXED" << endl;
break;
case DRIVE_REMOTE:
cout << "DRIVE_REMOTE" << endl;
break;
case DRIVE_CDROM:
cout << "DRIVE_CDROM" << endl;
break;
case DRIVE_RAMDISK:
cout << "DRIVE_RAMDISK" << endl;
break;
default:
cout << "default unbelievable" << endl;
break;
}
}
}
return 0;
}
阅读(485) | 评论(0) | 转发(0) |