[C++] 纯文本查看 复制代码
#include "stdafx.h"
#define MaxLength 124
int _tmain(int argc, _TCHAR* argv[])
{
TCHAR buffer[MaxLength];
UINT DriveType;
GetLogicalDriveStrings(MaxLength, buffer);
PTSTR Devices = (PTSTR)buffer;
do {
_tprintf (TEXT("The Type of %s : "), Devices);
DriveType = GetDriveType(Devices);
switch (DriveType) {
case DRIVE_UNKNOWN:
_tprintf (TEXT("The drive type cannot be determined."));
break;
case DRIVE_NO_ROOT_DIR:
_tprintf (TEXT("The root path is invalid; for example, there is no volume mounted at the specified path."));
break;
case DRIVE_REMOVABLE:
_tprintf (TEXT("The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader."));
break;
case DRIVE_FIXED:
_tprintf (TEXT("The drive has fixed media; for example, a hard drive or flash drive."));
break;
case DRIVE_REMOTE:
_tprintf (TEXT("The drive is a remote (network) drive."));
break;
case DRIVE_CDROM:
_tprintf (TEXT("The drive is a CD-ROM drive."));
break;
case DRIVE_RAMDISK:
_tprintf (TEXT("The drive is a RAM disk."));
break;
default:
break;
}
_tprintf (TEXT("\n"));
Devices += (lstrlen((LPCWSTR)Devices) + 1);
}while (*Devices);
return 0;
}