SHGetDiskFreeSpaceExA function (shellapi.h)

Retrieves disk space information for a disk volume.

Syntax

BOOL SHGetDiskFreeSpaceExA(
  [in]            LPCSTR         pszDirectoryName,
  [out, optional] ULARGE_INTEGER *pulFreeBytesAvailableToCaller,
  [out, optional] ULARGE_INTEGER *pulTotalNumberOfBytes,
  [out, optional] ULARGE_INTEGER *pulTotalNumberOfFreeBytes
);

Parameters

[in] pszDirectoryName

Type: LPCTSTR

A null-terminated string that specifies the volume for which size information is retrieved. This can be a drive letter, UNC name, or the path of a folder. You cannot use NULL to represent the current drive.

[out, optional] pulFreeBytesAvailableToCaller

Type: ULARGE_INTEGER*

Pointer to a value that receives the number of bytes on the volume available to the calling application. If the operating system implements per-user quotas, this value may be less than the total number of free bytes on the volume.

[out, optional] pulTotalNumberOfBytes

Type: ULARGE_INTEGER*

Pointer to a value that receives the total size of the volume, in bytes.

[out, optional] pulTotalNumberOfFreeBytes

Type: ULARGE_INTEGER*

Pointer to a value that receives the number of bytes of free space on the volume.

Return value

Type: BOOL

Returns TRUE if successful, FALSE otherwise.

Remarks

The similarly named function SHGetDiskFreeSpace is merely an alias for SHGetDiskFreeSpaceEx. When you call SHGetDiskFreeSpace you actually call this function.

This function calls the GetDiskFreeSpaceEx function if it is available on the operating system. If GetDiskFreeSpaceEx is not available, it is emulated by calling the GetDiskFreeSpace function and manipulating the return values. For additional information, see the documentation for GetDiskFreeSpaceEx.

Note

The shellapi.h header defines SHGetDiskFreeSpaceEx as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shellapi.h
Library Shell32.lib
DLL Shell32.dll (version 5.0 or later)

See also

GetDiskFreeSpaceEx

SHGetDiskFreeSpace