Edit

Share via


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 S_OK if the function succeeds, or a value from Common HRESULT Values if it fails. You can call GetLastError for extended error information.

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