Kernel32GetFileSize(SafeFileHandle, UInt32) Method

Note: This API is now obsolete.
Retrieves the size of the specified file, in bytes.

It is recommended that you use GetFileSizeEx(SafeFileHandle, Int64) instead.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", ExactSpelling = true, SetLastError = true)]
[ObsoleteAttribute("Call NativeMethods.GetFileSize() instead", true)]
public static uint GetFileSize(
	SafeFileHandle hFile,
	out uint fileSizeHigh
)

Parameters

hFile  SafeFileHandle
A handle to the file.
fileSizeHigh  UInt32
A pointer to the variable where the high-order doubleword of the file size is returned.

This parameter can be NULL if the application does not require the high-order doubleword.

Return Value

UInt32
If the function succeeds, the return value is the low-order doubleword of the file size, and, if fileSizeHigh is non-NULL, the function puts the high-order doubleword of the file size into the variable pointed to by that parameter.

If the function fails and fileSizeHigh is NULL, the return value is INVALID_FILE_SIZE.

When fileSizeHigh is NULL, the results returned for large files are ambiguous, and you will not be able to determine the actual size of the file. It is recommended that you use GetFileSizeEx(SafeFileHandle, Int64) instead.

If the function fails and fileSizeHigh is non-NULL, the return value is INVALID_FILE_SIZE and GetLastError will return a value other than NO_ERROR.

Remarks

See Also