GetVolumeInformation function kernel32

Win32Result<bool> GetVolumeInformation(
  1. PCWSTR? lpRootPathName,
  2. PWSTR? lpVolumeNameBuffer,
  3. int nVolumeNameSize,
  4. Pointer<Uint32>? lpVolumeSerialNumber,
  5. Pointer<Uint32>? lpMaximumComponentLength,
  6. Pointer<Uint32>? lpFileSystemFlags,
  7. PWSTR? lpFileSystemNameBuffer,
  8. int nFileSystemNameSize,
)

Retrieves information about the file system and volume associated with the specified root directory.

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

Implementation

Win32Result<bool> GetVolumeInformation(
  PCWSTR? lpRootPathName,
  PWSTR? lpVolumeNameBuffer,
  int nVolumeNameSize,
  Pointer<Uint32>? lpVolumeSerialNumber,
  Pointer<Uint32>? lpMaximumComponentLength,
  Pointer<Uint32>? lpFileSystemFlags,
  PWSTR? lpFileSystemNameBuffer,
  int nFileSystemNameSize,
) {
  final result_ = GetVolumeInformationW_Wrapper(
    lpRootPathName ?? nullptr,
    lpVolumeNameBuffer ?? nullptr,
    nVolumeNameSize,
    lpVolumeSerialNumber ?? nullptr,
    lpMaximumComponentLength ?? nullptr,
    lpFileSystemFlags ?? nullptr,
    lpFileSystemNameBuffer ?? nullptr,
    nFileSystemNameSize,
  );
  return .new(value: result_.value.i32 != FALSE, error: result_.error);
}