IMPORTANT: boot record start = 0x03 IMPORTANT: partition #1 start = 0x1BE IMPORTANT: partition #2 start = 0x1CE IMPORTANT: partition #3 start = 0x1DE IMPORTANT: partition #4 start = 0x1EE
Const boot_sector_ext_32= &h41
|
For long_ ilenames entries:
|
Step (1) | read LBA sector 0 (MBR-MasterBootRecord) of disk - sector length 512 bytes |
Step (2) | partition #1 record is at byte position 0x1BE - access it using a PARTITION ENTRY structure/record/type |
Step (3) | Now we have a PARTITION ENTRY . First byte is 0x80 if this partition is BOOTABLE or 0 if NOT! |
Step (4) | Byte 5 gives us information about PARTITION type. FAT partitions have following IDs: |
Step (4) | Once we indetifyed our partition type we analyze it's structure: starting sector and length If it's of type : fat12/fat16/fat32 then record entry named Number_of_sectors_preceding_the_partition + (plus) the position of MBR (sector 0 in out case) gives us the starting sector of our partition !. At that sector [Number_of_sectors_preceding_the_partition + MBR] we have the boot sector that is used to boot the operation system on that partition ! |
Step (5) | Repeat upword steps for the rest three partitions entries (there are 4 entries in total) |
Step (6) | Select your desired partition |
Step (7) | Read BOOT sector (1 sector, 512bytes) for your favorite partition, located at :[Number_of_sectors_preceding_the_partition + MBR] Boot sector of FAT partitions will give information about its settings/structure. |
Step (8) | Access boot record from withing BOOT_SECTOR ! Warning boot_record doesn't start at byte 1 of boot sector, but at byte 3 of the boot sector !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Entry [SectorsPerCluster] gives you the FAT block length = [SectorsPerCluster] * 512 = Cluster_size ([SectorsPerCluster] SHL 9) Entry [SectorsPerFAT] or [BigSectorsPerFAT] gives you the FileAllocationTable length How to choose between [SectorsPerFAT] and [BigSectorsPerFAT] ? If one of this items is zero (0) use the other one ! Or if [BigSectorsPerFAT] gives a too big FAT size (unusual) use the other entry [SectorsPerFAT] ! FAT chain starts at : [ReservedSectors] + [HiddenSectors] ! Warning some times [HiddenSectors] ! HiddeSectors value is actually equal with PARTITION.Number_of_sectors_preceding_the_partition ! In case HiddenSectors is 0 use PARTITION_TABLE(selectedpartition).Number_of_sectors_preceding_the_partition ! |