GetDiskFreeSpaceEx function kernel32

Win32Result<bool> GetDiskFreeSpaceEx(
  1. PCWSTR? lpDirectoryName,
  2. Pointer<Uint64>? lpFreeBytesAvailableToCaller,
  3. Pointer<Uint64>? lpTotalNumberOfBytes,
  4. Pointer<Uint64>? lpTotalNumberOfFreeBytes,
)

Retrieves information about the amount of space that is available on a disk volume, which is the total amount of space, the total amount of free space, and the total amount of free space available to the user that is associated with the calling thread.

To learn more, see learn.microsoft.com/windows/win32/api/fileapi/nf-fileapi-getdiskfreespaceexw.

Implementation

Win32Result<bool> GetDiskFreeSpaceEx(
  PCWSTR? lpDirectoryName,
  Pointer<Uint64>? lpFreeBytesAvailableToCaller,
  Pointer<Uint64>? lpTotalNumberOfBytes,
  Pointer<Uint64>? lpTotalNumberOfFreeBytes,
) {
  final result_ = GetDiskFreeSpaceExW_Wrapper(
    lpDirectoryName ?? nullptr,
    lpFreeBytesAvailableToCaller ?? nullptr,
    lpTotalNumberOfBytes ?? nullptr,
    lpTotalNumberOfFreeBytes ?? nullptr,
  );
  return Win32Result(value: result_.value.i32 != FALSE, error: result_.error);
}