Retrieves file information for the specified file.
For a more advanced version of this function, see GetFileInformationByHandleEx.
To set file information using a file handle, see SetFileInformationByHandle.
Syntax
BOOL WINAPI GetFileInformationByHandle(
__in HANDLE hFile,
__out LPBY_HANDLE_FILE_INFORMATION lpFileInformation
);
Parameters
- hFile [in]
-
A handle to the file that contains the information to be retrieved.
This handle should not be a pipe handle.
- lpFileInformation [out]
-
A pointer to a
BY_HANDLE_FILE_INFORMATION structure that receives the file information.
Return Value
If the function succeeds, the return value is nonzero and file information data is contained in the buffer pointed to by the lpFileInformation parameter.
If the function fails, the return value is zero. To get extended error information, call
GetLastError.
Remarks
Depending on the underlying network components of the operating system and the type of server connected to, the
GetFileInformationByHandle function may fail, return partial information, or full information for the given file.
You can compare the VolumeSerialNumber and FileIndex members returned in the BY_HANDLE_FILE_INFORMATION structure to determine if two paths map to the same target; for example, you can compare two file paths and determine if they map to the same directory.
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, see About Transactional NTFS.
Requirements
| Minimum supported client | Windows 2000 Professional |
| Minimum supported server | Windows 2000 Server |
| Header | WinBase.h (include Windows.h) |
| Library | Kernel32.lib |
| DLL | Kernel32.dll |
See Also
- File Management Functions
- GetFileInformationByHandleEx
- SetFileInformationByHandle
Send comments about this topic to Microsoft
Build date: 11/12/2009