Funktionreferenz


_WinAPI_GetFileInformationByHandle


Retrieves file information for the specified file

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

Parameter

$hFile Handle to the file that contains the information to be retrieved.

Rückgabewert

Success: The array containing the following information:
[0] - The file attributes (FILE_ATTRIBUTE_*).
[1] - $tagFILETIME structure that specifies when a file or directory is created.
[2] - $tagFILETIME structure that specifies the last time that a file is read from or written to.
[3] - $tagFILETIME structure that specifies the last time that a file is written to.
[4] - The serial number of the volume that contains a file.
[5] - The file size.
[6] - The number of links to this file.
[7] - The unique identifier that is associated with a file.
Failure: Sets the @error flag to non-zero, call _WinAPI_GetLastError() to get extended error information.

Bemerkungen

None.

Siehe auch

Suche nach GetFileInformationByHandle in der MSDN Bibliothek.

Beispiel

#include <Date.au3>
#include <WinAPIFiles.au3>
#include <WinAPIHObj.au3>

Local $hFile = _WinAPI_CreateFile(@ScriptFullPath, 2, 0, 6)
Local $aInfo = _WinAPI_GetFileInformationByHandle($hFile)
If IsArray($aInfo) Then
    For $i = 1 To 3
        If IsDllStruct($aInfo[$i]) Then
            Local $tFILETIME = _Date_Time_FileTimeToLocalFileTime($aInfo[$i])
            $aInfo[$i] = _Date_Time_FileTimeToSystemTime($tFILETIME)
            $aInfo[$i] = _Date_Time_SystemTimeToDateTimeStr($aInfo[$i])
        Else
            $aInfo[$i] = 'Unknown'
        EndIf
    Next
    ConsoleWrite('!Pfad:           ' & _WinAPI_GetFinalPathNameByHandle($hFile) & @CRLF)
    ConsoleWrite('!Attribute:     0x' & Hex($aInfo[0], 8) & @CRLF)
    ConsoleWrite('!Erstellt:       ' & $aInfo[1] & @CRLF)
    ConsoleWrite('!Letzter Zugriff:' & $aInfo[2] & @CRLF)
    ConsoleWrite('!Geändert:       ' & $aInfo[3] & @CRLF)
    ConsoleWrite('!Seriennummer:   ' & $aInfo[4] & @CRLF)
    ConsoleWrite('!Größe:          ' & $aInfo[5] & @CRLF)
    ConsoleWrite('!Links:          ' & $aInfo[6] & @CRLF)
    ConsoleWrite('!ID:             ' & $aInfo[7] & @CRLF)
EndIf
_WinAPI_CloseHandle($hFile)