#define VERSIONOFFSET 0x1e //Where the version information is stored #define PARTITION_TABLE 446 //Where the partition table begins #define BOOT_INDICATOR 0 //Offset to boot indicator #define BEGIN_SECT_HEAD 1 //Offset to beginning sector head number #define BEGIN_SECTOR 2 //Offset to Beginning sector #define BEGIN_CYLINDER 3 //Offset to beginning cylinder #define SYSTEM_ID 4 //Offset to system ID #define END_SECT_HEAD 5 //Offset to ending sector head number #define END_SECTOR 6 //Offset to ending sector #define END_CYLINDER 7 //Offset to ending cylinder #define PREC_SECTORS 8 //Dword count of sectors preceding this partition #define NUM_SECTORS 12 //Dword count of sectors in the partition #define SECTOR_MASK 0x63 //Mask off the two high bits of cylinder #define BOOT_SIGNATURE 0x1fe //Offset to signature bytes const int PartOffset[] = {0x1be, 0x1ce, 0x1de, 0x1ee}; const struct _part_type_ { char CanBoot; char Type; char *strName; } PartName[] = { { 0x01, 0x01, "DOS 12 bit FAT" }, { 0x01, 0x02, "Xenix" }, { 0x01, 0x04, "DOS 16 bit FAT" }, { 0x00, 0x05, "DOS Extended Partition" }, { 0x01, 0x06, "DOS 16 bit FAT" }, { 0x01, 0x07, "OS2 / NTFS" }, { 0x01, 0x0b, "DOS 32 bit FAT" }, { 0x00, 0x82, "Linux Swap" }, { 0x01, 0x83, "Linux Partition" }, { 0x00, 0x00, "" } }; struct _PartInfo_ { char strType[30]; // The user friendly system name char BootID[11]; // The name to display at boot time char Type; // The system ID char DefBoot; // Whether default partition or not char CanBoot; // Partition bootable (as far as we know) }; int __stdcall ReadBootSector(far char *buffer, char Drive); int __stdcall GetPartitionInfo(far char *Buffer, struct _PartInfo_ *, char Partition); int __stdcall WriteBootInfo(far char MinPartInfo[4][11], char Drive); int WriteMBR(far char *Buffer, char Drive); int ReadMBR(far char *Buffer, char Drive);