GetDiskSpaceInformationA function (fileapi.h)

Gets disk space information for a volume at a given root path.

Syntax

HRESULT GetDiskSpaceInformationA(
  LPCSTR                 rootPath,
  DISK_SPACE_INFORMATION *diskSpaceInfo
);

Parameters

rootPath

A pointer to a string that contains the root directory of the volume to be queried.

If this parameter is NULL, the function uses the root of the current disk.

diskSpaceInfo

A DISK_SPACE_INFORMATION structure containing information about the current disk space for the volume at the given root path.

Return value

Returns TRUE if the function succeeds, or FALSE if it fails. To get extended error information, call the GetLastError function.

Remarks

The rootPath must be a root path, such as C:\ or D:\, and not a subdirectory of a root path.

Requirements

Requirement Value
Minimum supported client Windows 10 Build 17763 [desktop apps | UWP apps]
Minimum supported server Windows 10 Server 2019 [desktop apps | UWP apps]
Header fileapi.h (include Windows.h)
Library kernel32.lib
DLL kernel32.dll

See also

GetDiskSpaceInformationW

DISK_SPACE_INFORMATION