Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

BY_HANDLE_FILE_INFORMATION structure (fileapi.h)

Feedback

In this article

Contains information that theGetFileInformationByHandle functionretrieves.

Syntax

typedef struct _BY_HANDLE_FILE_INFORMATION {  DWORD    dwFileAttributes;  FILETIME ftCreationTime;  FILETIME ftLastAccessTime;  FILETIME ftLastWriteTime;  DWORD    dwVolumeSerialNumber;  DWORD    nFileSizeHigh;  DWORD    nFileSizeLow;  DWORD    nNumberOfLinks;  DWORD    nFileIndexHigh;  DWORD    nFileIndexLow;} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION, *LPBY_HANDLE_FILE_INFORMATION;

Members

dwFileAttributes

The file attributes. For possible values and their descriptions, seeFile Attribute Constants.

ftCreationTime

AFILETIME structure that specifies when a file ordirectory is created. If the underlying file system does not support creation time, this member iszero (0).

ftLastAccessTime

AFILETIME structure. For a file, the structurespecifies the last time that a file is read from or written to. For a directory, the structure specifies when thedirectory is created. For both files and directories, the specified date is correct, but the time of day isalways set to midnight. If the underlying file system does not support the last access time, this member iszero (0).

ftLastWriteTime

AFILETIME structure. For a file, the structurespecifies the last time that a file is written to. For a directory, the structure specifies when the directoryis created. If the underlying file system does not support the last write time, this member is zero (0).

dwVolumeSerialNumber

The serial number of the volume that contains a file.

nFileSizeHigh

The high-order part of the file size.

nFileSizeLow

The low-order part of the file size.

nNumberOfLinks

The number of links to this file. For the FAT file system this member is always 1. For the NTFS filesystem, it can be more than 1.

nFileIndexHigh

The high-order part of a unique identifier that is associated with a file. For more information, seenFileIndexLow.

nFileIndexLow

The low-order part of a unique identifier that is associated with a file.

The identifier (low and high parts) and the volume serial number uniquely identify a file on a singlecomputer. To determine whether two open handles represent the same file, combine the identifier and the volumeserial number for each file and compare them.

The ReFS file system, introduced with Windows Server 2012, includes 128-bit file identifiers. Toretrieve the 128-bit file identifier use theGetFileInformationByHandleEx functionwithFileIdInfo to retrieve theFILE_ID_INFO structure. The 64-bit identifier in thisstructure is not guaranteed to be unique on ReFS.

Remarks

The identifier that is stored in thenFileIndexHigh andnFileIndexLow members is called the file ID. Support for file IDs is filesystem-specific. File IDs are not guaranteed to be unique over time, because file systems are free to reuse them.In some cases, the file ID for a file can change over time.

In the FAT file system, the file ID is generated from the first cluster of the containing directory and thebyte offset within the directory of the entry for the file. Some defragmentation products change this byte offset.(Windows in-box defragmentation does not.) Thus, a FAT file ID can change over time. Renaming a file in the FATfile system can also change the file ID, but only if the new file name is longer than the old one.

In the NTFS file system, a file keeps the same file ID until it is deleted. You can replace one file withanother file without changing the file ID by using theReplaceFile function. However, the file ID of thereplacement file, not the replaced file, is retained as the file ID of the resulting file.

Not all file systems can record creation and last access time, and not all file systems record them in thesame manner. For example, on a Windows FAT file system, create time has a resolution of 10 milliseconds, writetime has a resolution of 2 seconds, and access time has a resolution of 1 day (the access date). On the NTFS filesystem, access time has a resolution of 1 hour. For more information, seeFile Times.

Requirements

RequirementValue
Minimum supported clientWindows XP [desktop apps only]
Minimum supported serverWindows Server 2003 [desktop apps only]
Headerfileapi.h (include Windows.h)

See also

FILETIME

FILE_ID_INFO

File Attribute Constants

GetFileInformationByHandle

GetFileInformationByHandleEx


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?