Board index » delphi » Find Cluster size inn hard drive via Pascal

Find Cluster size inn hard drive via Pascal

Hi

Just a quick question, Has anyone got a fragment of code to find the cluster
and sector size of a hard drive on a PC (bigger than 32 meg partitions), I've
tried int 25 but I can't get it working.

Thanks in advance...

Darren Breeze

 

Re:Find Cluster size inn hard drive via Pascal


Quote
Darren Breeze (D...@hk.super.net) wrote:
> Just a quick question, Has anyone got a fragment of code to find the
> cluster and sector size of a hard drive on a PC (bigger than 32 meg
> partitions), I've tried int 25 but I can't get it working.

Function ClusterSize(c:Char):Word;
Type DPB = Record
        Numero     : Byte;
        SousUnite  : Byte;
        OctPSect   : Word;
        Interleave : Byte;
        SectPClust : Byte;
        Reserves   : Word;
        NbreDeFats : Byte;
        RootDir    : Word;
        PremSect   : Word;
        DernClust  : Word;
        SectPFat   : Byte;
        DataSect1  : Word;
        Driver     : Pointer;
        Media      : Byte;
        Flag       : Byte;
        NextDPB    : Pointer;
     End;
Var  p:^DPB;
     b:Byte;
     r:Registers;
Begin
  b:=Byte(UpCase(c)); ClusterSize:=0;
  if b in [$41..$5A] then Begin
    With r do Begin
      Ah:=$32; Dl:=b-$40; MsDos(r);
      p:=Ptr(ds,bx);
      if Al=0 then With p^ do ClusterSize:=(1 shl SectPClust)*OctPSect;
    End;
  End;
End;

--
Jean-Christophe Boggio                          c...@gestalt.freenix.fr
Pascal and Linux {*word*60}, Dos and Windows independant programmer.

Other Threads