函数参考


_WinAPI_GetFileID

Retrieves the file system's 8-byte file reference number for a file.

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

参数

$hFile A handle to the file or directory whose reference number is to be retrieved.

返回值

Success The 8-byte file reference number for the file.
Failure 0 and sets the @error flag to non-zero, @extended flag may contain the NTSTATUS code.

注意/说明

The file reference number is assigned by the file system and is file-system-specific. (Note that this is not the same
as the 16-byte "file object ID" that was added to NTFS for Microsoft Windows 2000.)

The file reference numbers, also called file IDs, are guaranteed to be unique only within a static file system.
They are not guaranteed to be unique over time, because file systems are free to reuse them. Nor are they guaranteed to
remain constant. For example, the FAT file system generates the file reference number for a file from the byte offset
of the file's directory entry record (DIRENT) on the disk. Defragmentation can change this byte offset. Thus a FAT
file reference number can change over time.

相关

详情参考

在MSDN中搜索


示例/演示


#Include <APIConstants.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $hFile

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

ConsoleWrite('Handle: ' & $hFile & @CR)
ConsoleWrite('ID:     ' & _WinAPI_GetFileID($hFile) & @CR)

_WinAPI_CloseHandle($hFile)