标签:
#include <Windows.h> #include <stdio.h> #include <stdlib.h> BOOL GetDriverInfo(LPSTR szDrive)//获得驱动器类型 { printf("%s\n",szDrive); UINT uDriveType; uDriveType = GetDriveType(szDrive); switch(uDriveType) { case DRIVE_UNKNOWN: printf("The drive type cannot be determined."); break; case DRIVE_NO_ROOT_DIR: printf("The root path is invalid, for example, no volume is mounted at the path."); break; case DRIVE_REMOVABLE: printf("The drive is a type that has removalbe media, for example, a floppy drive or removable hard disk."); break; case DRIVE_FIXED: printf("The drive is a type taht cannot be removed, for exalmpl, a fixed hard drive"); break; case DRIVE_REMOTE: printf("The drive is a remote (network)drive."); break; case DRIVE_CDROM: printf("The drive is a CD-Rome drive"); break; case DRIVE_RAMDISK: printf("The drive is a RAM disk."); break; default: break; } CHAR szDriveName[MAX_PATH]; DWORD dwVolumeSerialNumber; DWORD dwMaximumComponentLength; DWORD dwFileSystemFlags; CHAR szFileSystemNameBuffer[MAX_PATH]; if(!GetVolumeInformation( szDrive, szDriveName, MAX_PATH, &dwVolumeSerialNumber, &dwMaximumComponentLength, &dwFileSystemFlags, szFileSystemNameBuffer, MAX_PATH )) { return FALSE; } if(0 != lstrlen(szDriveName)) { printf("\nDrive Name is %s\n",szDriveName); } printf("\nVolume Serial Number is %u",dwVolumeSerialNumber); printf("\nMaximum Component Length is %u", dwMaximumComponentLength); printf("\nSystem Type is %s", szFileSystemNameBuffer); if(dwFileSystemFlags & FILE_VOLUME_QUOTAS) { printf("\nThe file system supports disk quotes.\n"); } if(dwFileSystemFlags & FILE_SUPPORTS_ENCRYPTION) { printf("\nThe file system supports encryption."); } printf("\n...\n"); return TRUE; } int main() { GetDriverInfo(TEXT("c:\\")); system("pause"); return 0; }
标签:
原文地址:http://www.cnblogs.com/gongyan/p/4341239.html