[fpc-pascal]get size of clusters
Michail A.Baikov
baikov at mosfilm.ru
Wed Sep 27 21:21:12 CEST 2000
Who want subj? Please:
function cnhDiskInfo(Drive: Byte; var AAvailClusters, ATotalClusters,
ABytesPerSector, ASectorsPerCluster: Longint): Boolean;
type
TFSInfoBuf = packed record
filesysid: ULONG;
sectornum: ULONG;
unitnum: ULONG;
unitavail: ULONG;
bytesnum: USHORT;
end;
var
fsInfoBuf: TFSInfoBuf;
rc: APIRET;
begin
AAvailClusters := -1;
ATotalClusters := -1;
ABytesPerSector := -1;
ASectorsPerCluster := -1;
Result := False;
rc := DosQueryFSInfo(
Drive,
FSIL_ALLOC,
fsInfoBuf,
SizeOf(fsInfoBuf)
);
if rc <> NO_ERROR then
Exit;
AAvailClusters := fsInfoBuf.unitavail;
ATotalClusters := fsInfoBuf.unitnum;
ABytesPerSector := fsInfoBuf.bytesnum;
ASectorsPerCluster := fsInfoBuf.sectornum;
Result := True;
end;
Question?
More information about the fpc-pascal
mailing list