GetDiskFreeSpace function kernel32

Win32Result<bool> GetDiskFreeSpace(
  1. PCWSTR? lpRootPathName,
  2. Pointer<Uint32>? lpSectorsPerCluster,
  3. Pointer<Uint32>? lpBytesPerSector,
  4. Pointer<Uint32>? lpNumberOfFreeClusters,
  5. Pointer<Uint32>? lpTotalNumberOfClusters,
)

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,
) {
  final result_ = GetDiskFreeSpaceW_Wrapper(
    lpRootPathName ?? nullptr,
    lpSectorsPerCluster ?? nullptr,
    lpBytesPerSector ?? nullptr,
    lpNumberOfFreeClusters ?? nullptr,
    lpTotalNumberOfClusters ?? nullptr,
  );
  return Win32Result(value: result_.value.i32 != FALSE, error: result_.error);
}