GetDiskFreeSpace function kernel32
Retrieves information about the specified disk, including the amount of free space on the disk.
To learn more, see learn.microsoft.com/windows/win32/api/fileapi/nf-fileapi-getdiskfreespacew.
Implementation
Win32Result<bool> GetDiskFreeSpace(
PCWSTR? lpRootPathName,
Pointer<Uint32>? lpSectorsPerCluster,
Pointer<Uint32>? lpBytesPerSector,
Pointer<Uint32>? lpNumberOfFreeClusters,
Pointer<Uint32>? lpTotalNumberOfClusters,
) {
resolveGetLastError();
final result_ = _GetDiskFreeSpace(
lpRootPathName ?? nullptr,
lpSectorsPerCluster ?? nullptr,
lpBytesPerSector ?? nullptr,
lpNumberOfFreeClusters ?? nullptr,
lpTotalNumberOfClusters ?? nullptr,
);
return .new(value: result_ != FALSE, error: GetLastError());
}