///// Function to get Drive Parameters \\\\\
unsigned long getdrivegeometry (int drive)
{
union REGS i, o ;
struct SREGS s ;
struct geometry g = { 26, 0, 0, 0, 0, 0, 0, 0 } ;
i.h.ah = 0x48 ; /* Function Number 0x48 of INT 13H
Extensions See the Comments
Below */
i.h.dl = drive; /* Drive Number */
i.x.si = FP_OFF ( (void far*)&g ) ;
s.ds = FP_SEG ( (void far*)&g ) ;
/* Invoke the specified function number of INT 13H
extension with Segment Register Values */
int86x ( 0x13, &i, &o, &s ) ;
printf("\n Head = %lu, Sectors Per Track = %lu, Cylinder =
%lu\n", g.heads, g.spt, g.cyl);
/* If get drive Geometry function Fails, Display
Error Message and Exit */
if(g.spt==0)
{
printf("\n Get Drive Geometry Function Fails....");
printf("\n Extensions Not Supported, Press any Key to
Exit...");
getch();
exit(1);
}
return *g.sectors; /* Return The Number of Sectors
on Drive */
}
////// Start Of Main \\\\\\
void main()
{
unsigned long loop=0, Sectors_in_HDD1=0, Sectors_in_HDD2=0;
unsigned char buffer[61440]; /* Data buffer of 61440
Bytes to Read/Write 120 Sectors of 512 Bytes at a time to save time. */
char choice;
clrscr();
|