Expand Minimize

GetFileSizeEx function

Retrieves the size of the specified file.

Syntax


BOOL WINAPI GetFileSizeEx(
  _In_   HANDLE hFile,
  _Out_  PLARGE_INTEGER lpFileSize
);

Parameters

hFile [in]

A handle to the file. The handle must have been created with the FILE_READ_ATTRIBUTES access right or equivalent, or the caller must have sufficient permission on the directory that contains the file. For more information, see File Security and Access Rights.

lpFileSize [out]

A pointer to a LARGE_INTEGER structure that receives the file size, in bytes.

Return value

If the function succeeds, the return value is nonzero.

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

Remarks

Transacted Operations:  If there is a transaction bound to the file handle, then the function returns information for the isolated file view.

Windows Store apps:  GetFileSizeEx is not supported. Use GetFileInformationByHandleEx.

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

TechnologySupported

Server Message Block (SMB) 3.0 protocol

Yes

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

 

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

FileAPI.h (include Windows.h);
WinBase.h on Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

See also

File Management Functions
LARGE_INTEGER

 

 

Community Additions

ADD
Show:
© 2014 Microsoft