Function Reference


_WinAPI_GetVolumeInformationByHandle

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

#include <WinAPIFiles.au3>
_WinAPI_GetVolumeInformationByHandle ( $hFile )

Parameters

$hFile A handle to the file.

Return Value

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.
Failure: Sets the @error flag to non-zero, call _WinAPI_GetLastError() to get extended error information.

Remarks

This function requires Windows Vista or later.

See Also

Search GetVolumeInformationByHandleW in MSDN Library.

Example

#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <WinAPIHObj.au3>
#include <WinAPISys.au3>

If Number(_WinAPI_GetVersion()) < 6.0 Then
        MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', 'Require Windows Vista or later.')
        Exit
EndIf

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

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