...check if a partition is NTFS or FAT formated?

Author: Roland Frei

Category: System

function GetHardDiskPartitionType(const DriveLetter: Char): string;
  // FAT
  // NTFS
var
  
NotUsed: DWORD;
  VolumeFlags: DWORD;
  VolumeInfo: array[0..MAX_PATH] of Char;
  VolumeSerialNumber: DWORD;
  PartitionType: array[0..32] of Char;
begin
  
GetVolumeInformation(PChar(DriveLetter + ':\'),
    nil, SizeOf(VolumeInfo), @VolumeSerialNumber, NotUsed,
    VolumeFlags, PartitionType, 32);
  Result := PartitionType;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  
ShowMessage(GetHardDiskPartitionType('c'));
  ShowMessage(GetHardDiskPartitionType('a'));
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base