Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.7 KiB

  1. //
  2. // mbr.h - minimum stuff to allow diskpart to work on MBRs.
  3. //
  4. //
  5. // MBR:
  6. // There are 3 kinds of MBRs.
  7. // 1. GPT Shadow MBR - an MBR filled in with particular values
  8. // to keep legacy software from puking on GPT disks.
  9. // 2. MBR base - an MBR that allows for up to 4 paritions.
  10. // 3. Extended MBR - nested inside other MBRs to allow more than
  11. // 4 partitions on a non-GPT disk.
  12. //
  13. // This program, and therefore this header file, is only concerned
  14. // with case 1, and a limited subset of case 2.
  15. //
  16. //
  17. // MBR contains code, with a table of 4 Partition entries and
  18. // a signature at the end.
  19. //
  20. #pragma pack (1)
  21. typedef struct _MBR_ENTRY {
  22. CHAR8 ActiveFlag; // Bootable or not
  23. CHAR8 StartingTrack; // Not used
  24. CHAR8 StartingCylinderLsb; // Not used
  25. CHAR8 StartingCylinderMsb; // Not used
  26. CHAR8 PartitionType; // 12 bit FAT, 16 bit FAT etc.
  27. CHAR8 EndingTrack; // Not used
  28. CHAR8 EndingCylinderLsb; // Not used
  29. CHAR8 EndingCylinderMsb; // Not used
  30. UINT32 StartingSector; // Hidden sectors
  31. UINT32 PartitionLength; // Sectors in this partition
  32. } MBR_ENTRY;
  33. //
  34. // Number of partition table entries
  35. //
  36. #define NUM_PARTITION_TABLE_ENTRIES 4
  37. //
  38. // Partition table record and boot signature offsets in bytes
  39. //
  40. #define MBR_TABLE_OFFSET (0x1be)
  41. #define MBR_SIGNATURE_OFFSET (0x200 - 2)
  42. //
  43. // Boot record signature value.
  44. //
  45. #define BOOT_RECORD_SIGNATURE (0xaa55)
  46. //
  47. // Special Partition type used only on GPT disks
  48. //
  49. #define PARTITION_TYPE_GPT_SHADOW (0xEE)
  50. #pragma pack ()