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