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 focus mode

GetFileInformationByHandle function (fileapi.h)

  • 2022-07-27
Feedback

In this article

Retrieves file information for the specified file.

For a more advanced version of this function, seeGetFileInformationByHandleEx.

To set file information using a file handle, seeSetFileInformationByHandle.

Syntax

BOOL GetFileInformationByHandle(  [in]  HANDLE                       hFile,  [out] LPBY_HANDLE_FILE_INFORMATION lpFileInformation);

Parameters

[in] hFile

A handle to the file that contains the information to be retrieved.

This handle should not be a pipe handle.

[out] lpFileInformation

A pointer to aBY_HANDLE_FILE_INFORMATION structure thatreceives the file information.

Return value

If the function succeeds, the return value is nonzero and file information data is contained in the bufferpointed to by thelpFileInformation parameter.

If the function fails, the return value is zero. To get extended error information, callGetLastError.

Remarks

Depending on the underlying network features of the operating system and the type of server connected to, theGetFileInformationByHandle function may fail,return partial information, or full information for the given file.

You can compare theVolumeSerialNumber andFileIndexmembers returned in theBY_HANDLE_FILE_INFORMATION structure todetermine if two paths map to the same target; for example, you can compare two file paths and determine if theymap to the same directory.

IIn Windows 8 and Windows Server 2012, this function is supported by the following technologies.

TechnologySupported
Server Message Block (SMB) 3.0 protocolYes
SMB 3.0 Transparent Failover (TFO)Yes
SMB 3.0 with Scale-out File Shares (SO)Yes
Cluster Shared Volume File System (CsvFS)Yes
Resilient File System (ReFS)Yes
 

Transacted Operations

If there is a transaction bound to the thread at the time of the call, then the function returns the compressed file size of the isolated file view. For more information, seeAbout Transactional NTFS.

Requirements

RequirementValue
Minimum supported clientWindows XP [desktop apps only]
Minimum supported serverWindows Server 2003 [desktop apps only]
Target PlatformWindows
Headerfileapi.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See also

File Management Functions

GetFileInformationByHandleEx

SetFileInformationByHandle


Feedback

Was this page helpful?

YesNo

In this article

Was this page helpful?

YesNo