15,979
社区成员
发帖
与我相关
我的任务
分享
BOOL WINAPI GetVolumeInformation(
__in_opt LPCTSTR lpRootPathName,
__out LPTSTR lpVolumeNameBuffer,
__in DWORD nVolumeNameSize,
__out_opt LPDWORD lpVolumeSerialNumber,
__out_opt LPDWORD lpMaximumComponentLength,
__out_opt LPDWORD lpFileSystemFlags,
__out LPTSTR lpFileSystemNameBuffer,
__in DWORD nFileSystemNameSize
);
Parameters
lpRootPathName
A pointer to a string that contains the root directory of the volume to be described.
If this parameter is NULL, the root of the current directory is used. A trailing backslash is required. For example, you specify \\MyServer\MyShare as "\\MyServer\MyShare\", or the C drive as "C:\".
TCHAR Volumelabel[MAX_PATH + 1] = {0};
TCHAR FileSysName[MAX_PATH + 1] = {0};
GetVolumeInformation(L"C:\\", Volumelabel, MAX_PATH,NULL, NULL, NULL, FileSysName, MAX_PATH);
CString str;
str.Format(_T("%s - %s"), Volumelabel, FileSysName);
AfxMessageBox(str);
GetVolumeInformation(L"D:\\", Volumelabel, MAX_PATH,NULL, NULL, NULL, FileSysName, MAX_PATH);
str.Format(_T("%s - %s"), Volumelabel, FileSysName);
AfxMessageBox(str);
VS2008下测试一下,可以得到非系统盘D:的FileSysName,为NTFS