API如何获得驱动器的文件系统?

AirRafer 2008-04-19 10:04:52
文件系统就是 FAT,NTFS,NDFS之类的
...全文
70 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
scq2099yt 2008-04-19
GetVolumeInformation
The GetVolumeInformation function returns information about a file system and volume whose root directory is specified.

BOOL GetVolumeInformation(
LPCTSTR lpRootPathName, // address of root directory of the
// file system
LPTSTR lpVolumeNameBuffer, // address of name of the volume
DWORD nVolumeNameSize, // length of lpVolumeNameBuffer
LPDWORD lpVolumeSerialNumber, // address of volume serial number
LPDWORD lpMaximumComponentLength,
// address of system's maximum
// filename length
LPDWORD lpFileSystemFlags, // address of file system flags
LPTSTR lpFileSystemNameBuffer, // address of name of file system
DWORD nFileSystemNameSize // length of lpFileSystemNameBuffer
);

Parameters
lpRootPathName
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. If this parameter is a UNC name, you must follow it with an additional backslash. For example, you would specify \\MyServer\MyShare as \\MyServer\MyShare\.
lpVolumeNameBuffer
Pointer to a buffer that receives the name of the specified volume.
nVolumeNameSize
Specifies the length, in characters, of the volume name buffer. This parameter is ignored if the volume name buffer is not supplied.
lpVolumeSerialNumber
Pointer to a variable that receives the volume serial number. This parameter can be NULL if the serial number is not required.
lpMaximumComponentLength
Pointer to a doubleword value that receives the maximum length, in characters, of a filename component supported by the specified file system. A filename component is that portion of a filename between backslashes.
The value stored in variable pointed to by *lpMaximumComponentLength is used to indicate that long names are supported by the specified file system. For example, for a FAT file system supporting long names, the function stores the value 255, rather than the previous 8.3 indicator. Long names can also be supported on systems that use the NTFS file system.

lpFileSystemFlags
Pointer to a doubleword that receives flags associated with the specified file system. This parameter can be any combination of the following flags, however, FS_FILE_COMPRESSION and FS_VOL_IS_COMPRESSED are mutually exclusive. Value Meaning
FS_CASE_IS_PRESERVED The file system preserves the case of filenames when it places a name on disk.
FS_CASE_SENSITIVE The file system supports case-sensitive filenames.
FS_UNICODE_STORED_ON_DISK The file system supports Unicode in filenames as they appear on disk.
FS_PERSISTENT_ACLS The file system preserves and enforces ACLs. For example, NTFS preserves and enforces ACLs, and FAT does not.
FS_FILE_COMPRESSION The file system supports file-based compression.
FS_VOL_IS_COMPRESSED The specified volume is a compressed volume; for example, a DoubleSpace volume.
FILE_SUPPORTS_ENCRYPTION The file system supports the Encrypted File System (EFS).
FILE_SUPPORTS_OBJECT_IDS The file system supports object identifiers.
FILE_SUPPORTS_REPARSE_POINTS The file system supports reparse points.
FILE_SUPPORTS_SPARSE_FILES The file system supports sparse files.
FILE_VOLUME_QUOTAS The file system supports disk quotas.


lpFileSystemNameBuffer
Pointer to a buffer that receives the name of the file system (such as FAT or NTFS).
nFileSystemNameSize
Specifies the length, in characters, of the file system name buffer. This parameter is ignored if the file system name buffer is not supplied.
Return Values
If all the requested information is retrieved, the return value is nonzero.

If not all the requested information is retrieved, the return value is zero. To get extended error information, call GetLastError.

回复
zgl7903 2008-04-19
GetVolumeInformation
详情查看MSDN
回复
相关推荐
发帖
硬件/系统
创建于2007-09-28

2594

社区成员

VC/MFC 硬件/系统
申请成为版主
帖子事件
创建了帖子
2008-04-19 10:04
社区公告
暂无公告