Annotation of truecrypt/boot/windows/bootconfig.cpp, revision 1.1.1.3

1.1       root        1: /*
                      2:  Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
                      3: 
1.1.1.3 ! root        4:  Governed by the TrueCrypt License 2.6 the full text of which is contained
1.1       root        5:  in the file License.txt included in TrueCrypt binary and source code
                      6:  distribution packages.
                      7: */
                      8: 
                      9: #include "BootConfig.h"
                     10: 
                     11: byte BootSectorFlags;
                     12: 
                     13: byte BootLoaderDrive;
                     14: byte BootDrive;
                     15: bool BootDriveGeometryValid = false;
1.1.1.3 ! root       16: bool PreventNormalSystemBoot = false;
        !            17: bool PreventBootMenu = false;
        !            18: char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1];
        !            19: uint16 OuterVolumeBackupHeaderCrc;
        !            20: 
        !            21: bool BootStarted = false;
1.1.1.2   root       22: 
1.1       root       23: DriveGeometry BootDriveGeometry;
                     24: 
                     25: CRYPTO_INFO *BootCryptoInfo;
                     26: Partition EncryptedVirtualPartition;
1.1.1.2   root       27: 
                     28: Partition ActivePartition;
                     29: Partition PartitionFollowingActive;
                     30: uint64 HiddenVolumeStartUnitNo;
                     31: uint64 HiddenVolumeStartSector;
                     32: 
                     33: 
1.1.1.3 ! root       34: #ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE
        !            35: 
        !            36: void ReadBootSectorUserConfiguration ()
        !            37: {
        !            38:        byte userConfig;
        !            39: 
        !            40:        AcquireSectorBuffer();
        !            41: 
        !            42:        if (ReadWriteMBR (false, BootLoaderDrive, true) != BiosResultSuccess)
        !            43:                goto ret;
        !            44: 
        !            45:        userConfig = SectorBuffer[TC_BOOT_SECTOR_USER_CONFIG_OFFSET];
        !            46:        PreventBootMenu = (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_ESC);
        !            47: 
        !            48:        memcpy (CustomUserMessage, SectorBuffer + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH);
        !            49:        CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH] = 0;
        !            50: 
        !            51:        if (userConfig & TC_BOOT_USER_CFG_FLAG_SILENT_MODE)
        !            52:        {
        !            53:                if (CustomUserMessage[0])
        !            54:                        Print (CustomUserMessage);
        !            55:                
        !            56:                DisableScreenOutput();
        !            57:        }
        !            58:        
        !            59:        OuterVolumeBackupHeaderCrc = *(uint16 *) (SectorBuffer + TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET);
        !            60: 
        !            61: ret:
        !            62:        ReleaseSectorBuffer();
        !            63: }
        !            64: 
        !            65: 
1.1.1.2   root       66: BiosResult UpdateBootSectorConfiguration (byte drive)
                     67: {
                     68:        AcquireSectorBuffer();
                     69: 
                     70:        BiosResult result = ReadWriteMBR (false, drive);
                     71:        if (result != BiosResultSuccess)
                     72:                goto ret;
                     73: 
                     74:        SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags;
                     75:        result = ReadWriteMBR (true, drive);
                     76: 
                     77: ret:
                     78:        ReleaseSectorBuffer();
                     79:        return result;
                     80: }
1.1.1.3 ! root       81: 
        !            82: #endif // !TC_WINDOWS_BOOT_RESCUE_DISK_MODE

unix.superglobalmegacorp.com

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