|
|
1.1 ! root 1: /* ! 2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. ! 3: ! 4: Governed by the TrueCrypt License 2.4 the full text of which is contained ! 5: in the file License.txt included in TrueCrypt binary and source code ! 6: distribution packages. ! 7: */ ! 8: ! 9: #ifndef TC_HEADER_Boot_BootDiskIo ! 10: #define TC_HEADER_Boot_BootDiskIo ! 11: ! 12: #include "Bios.h" ! 13: ! 14: #pragma pack(1) ! 15: ! 16: struct PartitionEntryMBR ! 17: { ! 18: byte BootIndicator; ! 19: ! 20: byte StartHead; ! 21: byte StartCylSector; ! 22: byte StartCylinder; ! 23: ! 24: byte Type; ! 25: ! 26: byte EndHead; ! 27: byte EndSector; ! 28: byte EndCylinder; ! 29: ! 30: uint32 StartLBA; ! 31: uint32 SectorCountLBA; ! 32: }; ! 33: ! 34: struct MBR ! 35: { ! 36: byte Code[446]; ! 37: PartitionEntryMBR Partitions[4]; ! 38: uint16 Signature; ! 39: }; ! 40: ! 41: struct BiosLbaPacket ! 42: { ! 43: byte Size; ! 44: byte Reserved; ! 45: uint16 SectorCount; ! 46: uint32 Buffer; ! 47: uint64 Sector; ! 48: }; ! 49: ! 50: #pragma pack() ! 51: ! 52: ! 53: struct ChsAddress ! 54: { ! 55: uint16 Cylinder; ! 56: byte Head; ! 57: byte Sector; ! 58: }; ! 59: ! 60: struct Partition ! 61: { ! 62: byte Number; ! 63: byte Drive; ! 64: bool Active; ! 65: uint64 EndSector; ! 66: bool Primary; ! 67: uint64 SectorCount; ! 68: uint64 StartSector; ! 69: ChsAddress StartChsAddress; ! 70: byte Type; ! 71: }; ! 72: ! 73: struct DriveGeometry ! 74: { ! 75: uint16 Cylinders; ! 76: byte Heads; ! 77: byte Sectors; ! 78: }; ! 79: ! 80: ! 81: void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba); ! 82: BiosResult GetActivePartition (byte drive, Partition &partition, size_t &partitionCount, bool silent); ! 83: BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent = false); ! 84: BiosResult GetDrivePartitions (byte drive, Partition *partitionArray, size_t partitionArrayCapacity, size_t &partitionCount, bool activeOnly = false, bool silent = false); ! 85: void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs); ! 86: void Print (const ChsAddress &chs); ! 87: void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs = nullptr); ! 88: BiosResult ReadMBR (byte drive, MBR &mbr, bool silent = false); ! 89: BiosResult ReadSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false); ! 90: BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false); ! 91: BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 §or, uint16 sectorCount, bool silent); ! 92: BiosResult WriteSectors (byte *buffer, byte drive, const uint64 §or, uint16 sectorCount, bool silent = false); ! 93: BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false); ! 94: ! 95: #endif // TC_HEADER_Boot_BootDiskIo
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.