函数参考


_WinAPI_GetVolumeInformationByHandle

Retrieves information about the file system and volume associated with the specified file.

#Include <WinAPIEx.au3>
_WinAPI_GetVolumeInformationByHandle ( $hFile )

参数

$hFile 一个文件句柄.

返回值

Success The array that contains the following information:
[0] - The name of a volume.
[2] - The serial number of a volume.
[1] - The maximum length, in TCHARs, of a file name component that a file system supports.
[3] - The flags associated with the file system ($FILE_*).
[4] - The name of the file system, for example, "FAT", "NTFS", etc.
失败: 返回 0 并设置 @error 标志为非 0 值.

注意/说明

本函数需要 Windows Vista 或更高版本系统.

相关

详情参考

在MSDN中搜索


示例/演示


#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

If _WinAPI_GetVersion() < '6.0' Then
    MsgBox(16, 'Error', 'Require Windows Vista or later.')
    Exit
EndIf

Global $hFile, $aInfo

$hFile = _WinAPI_CreateFile(@ScriptFullPath, 2, 0, 6)
$aInfo = _WinAPI_GetVolumeInformationByHandle($hFile)
_WinAPI_CloseHandle($hFile)

ConsoleWrite('Volume name: ' & $aInfo[0] & @CR)
ConsoleWrite('File system: ' & $aInfo[4] & @CR)
ConsoleWrite('Serial number: ' & $aInfo[1] & @CR)
ConsoleWrite('File name length: ' & $aInfo[2] & @CR)
ConsoleWrite('Flags: 0x' & Hex($aInfo[3]) & @CR)