Annotation of truecrypt/boot/windows/bootdiskio.h, revision 1.1.1.9

1.1       root        1: /*
1.1.1.8   root        2:  Copyright (c) 2008-2009 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: 
                     16: enum
                     17: {
                     18:        BiosResultEccCorrected = 0x11
                     19: };
1.1       root       20: 
                     21: #pragma pack(1)
                     22: 
                     23: struct PartitionEntryMBR
                     24: {
                     25:        byte BootIndicator;
                     26: 
                     27:        byte StartHead;
                     28:        byte StartCylSector;
                     29:        byte StartCylinder;
                     30: 
                     31:        byte Type;
                     32: 
                     33:        byte EndHead;
                     34:        byte EndSector;
                     35:        byte EndCylinder;
                     36: 
                     37:        uint32 StartLBA;
                     38:        uint32 SectorCountLBA;
                     39: };
                     40: 
                     41: struct MBR
                     42: {
                     43:        byte Code[446];
                     44:        PartitionEntryMBR Partitions[4];
                     45:        uint16 Signature;
                     46: };
                     47: 
                     48: struct BiosLbaPacket
                     49: {
                     50:        byte Size;
                     51:        byte Reserved;
                     52:        uint16 SectorCount;
                     53:        uint32 Buffer;
                     54:        uint64 Sector;
                     55: };
                     56: 
                     57: #pragma pack()
                     58: 
                     59: 
                     60: struct ChsAddress
                     61: {
                     62:        uint16 Cylinder;
                     63:        byte Head;
                     64:        byte Sector;
                     65: };
                     66: 
                     67: struct Partition
                     68: {
                     69:        byte Number;
                     70:        byte Drive;
                     71:        bool Active;
                     72:        uint64 EndSector;
                     73:        bool Primary;
                     74:        uint64 SectorCount;
                     75:        uint64 StartSector;
                     76:        byte Type;
                     77: };
                     78: 
                     79: struct DriveGeometry
                     80: {
                     81:        uint16 Cylinders;
                     82:        byte Heads;
                     83:        byte Sectors;
                     84: };
                     85: 
                     86: 
1.1.1.2   root       87: #ifdef TC_BOOT_DEBUG_ENABLED
                     88: void AcquireSectorBuffer ();
                     89: void ReleaseSectorBuffer ();
                     90: #else
                     91: #      define AcquireSectorBuffer()
                     92: #      define ReleaseSectorBuffer()
                     93: #endif
                     94: 
1.1       root       95: void ChsToLba (const DriveGeometry &geometry, const ChsAddress &chs, uint64 &lba);
1.1.1.7   root       96: bool GetActivePartition (byte drive);
1.1       root       97: BiosResult GetDriveGeometry (byte drive, DriveGeometry &geometry, bool silent = false);
1.1.1.3   root       98: 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       99: bool IsLbaSupported (byte drive);
1.1       root      100: void LbaToChs (const DriveGeometry &geometry, const uint64 &lba, ChsAddress &chs);
                    101: void Print (const ChsAddress &chs);
                    102: void PrintDiskError (BiosResult error, bool write, byte drive, const uint64 *sector, const ChsAddress *chs = nullptr);
1.1.1.3   root      103: void PrintSectorCountInMB (const uint64 &sectorCount);
                    104: BiosResult ReadWriteMBR (bool write, byte drive, bool silent = false);
1.1.1.2   root      105: BiosResult ReadSectors (uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
1.1       root      106: BiosResult ReadSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
                    107: BiosResult ReadSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
                    108: BiosResult ReadWriteSectors (bool write, uint16 bufferSegment, uint16 bufferOffset, byte drive, const uint64 &sector, uint16 sectorCount, bool silent);
                    109: BiosResult WriteSectors (byte *buffer, byte drive, const uint64 &sector, uint16 sectorCount, bool silent = false);
                    110: BiosResult WriteSectors (byte *buffer, byte drive, const ChsAddress &chs, byte sectorCount, bool silent = false);
                    111: 
1.1.1.2   root      112: extern byte SectorBuffer[TC_LB_SIZE];
                    113: 
1.1       root      114: #endif // TC_HEADER_Boot_BootDiskIo

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.