Board index » delphi » How could I access into the Boot Sector?

How could I access into the Boot Sector?

How could I access into the Boot Sector of the diskette or hard disk
and write some data in? For example: Formatting Diskette, etc?
 

Re:How could I access into the Boot Sector?


Johnny 'n' Simon (simj...@pop.jaring.my) wrote:

Quote
> How could I access into the Boot Sector of the diskette or hard disk
> and write some data in? For example: Formatting Diskette, etc?

To access the Boot sector of a disk(ette), just use Int 25h/26h (same
parameters). These functions do LOGICAL read/writes that is, a disk
containing multiple partitions has multiple boot sectors :

Ah=25h (read) or 26h (write)
Al=disk number (0=A 1=B...)
CX=number of sectors to read/write
DX=First sector to read/write
DS:BX=Memory area used for the transfer (remember to save DS :))

The boot record is located on sector #0

So, to read C:'s boot record :
Ah=25h Al=2 CX=1 DX=0 DS:BX=@YourBootRecord

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

Other Threads