Platform SDK: Files and I/O |
The GetVolumeInformation function retrieves information about a file system and volume whose root directory is specified.
BOOL GetVolumeInformation( LPCTSTR lpRootPathName, // root directory LPTSTR lpVolumeNameBuffer, // volume name buffer DWORD nVolumeNameSize, // length of name buffer LPDWORD lpVolumeSerialNumber, // volume serial number LPDWORD lpMaximumComponentLength, // maximum file name length LPDWORD lpFileSystemFlags, // file system options LPTSTR lpFileSystemNameBuffer, // file system name buffer DWORD nFileSystemNameSize // length of file system name buffer );
Windows 95/98: If the queried volume is a network drive, the serial number will not be returned.
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.
Value | Meaning |
---|---|
FS_CASE_IS_PRESERVED | The file system preserves the case of file names when it places a name on disk. |
FS_CASE_SENSITIVE | The file system supports case-sensitive file names. |
FS_UNICODE_STORED_ON_DISK | The file system supports Unicode in file names 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_NAMED_STREAMS | The file system supports named streams. |
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. |
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.
If you are attempting to obtain information about a floppy drive that does not have a floppy disk or a CD-ROM drive that does not have a compact disc, the system displays a message box asking the user to insert a floppy disk or a compact disc, respectively. To prevent the system from displaying this message box, call the SetErrorMode function with SEM_FAILCRITICALERRORS.
The FS_VOL_IS_COMPRESSED flag is the only indicator of volume-based compression. The file system name is not altered to indicate compression. This flag comes back set on a DoubleSpace volume, for example. With volume-based compression, an entire volume is either compressed or not compressed.
The FS_FILE_COMPRESSION flag indicates whether a file system supports file-based compression. With file-based compression, individual files can be compressed or not compressed.
The FS_FILE_COMPRESSION and FS_VOL_IS_COMPRESSED flags are mutually exclusive; both bits cannot come back set.
The maximum component length value, stored in lpMaximumComponentLength, is the only indicator that a volume supports longer-than-normal FAT (or other file system) file names. The file system name is not altered to indicate support for long file names.
The GetCompressedFileSize function obtains the compressed size of a file. The GetFileAttributes function can determine whether an individual file is compressed.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.
File Systems Overview, File System Functions, GetCompressedFileSize, GetFileAttributes, SetErrorMode, SetVolumeLabel