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

1.1       root        1: /*
1.1.1.9 ! root        2:  Copyright (c) 2008-2012 TrueCrypt Developers Association. All rights reserved.
1.1       root        3: 
1.1.1.8   root        4:  Governed by the TrueCrypt License 3.0 the full text of which is contained in
1.1.1.7   root        5:  the file License.txt included in TrueCrypt binary and source code distribution
                      6:  packages.
1.1       root        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];
1.1.1.4   root       19: uint32 OuterVolumeBackupHeaderCrc;
1.1.1.3   root       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;
1.1.1.6   root       30: bool ExtraBootPartitionPresent = false;
1.1.1.2   root       31: uint64 HiddenVolumeStartUnitNo;
                     32: uint64 HiddenVolumeStartSector;
                     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];
1.1.1.8   root       46: 
                     47: #ifdef TC_WINDOWS_BOOT_AES
                     48:        EnableHwEncryption (!(userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_HW_ENCRYPTION));
                     49: #endif
                     50: 
1.1.1.3   root       51:        PreventBootMenu = (userConfig & TC_BOOT_USER_CFG_FLAG_DISABLE_ESC);
                     52: 
                     53:        memcpy (CustomUserMessage, SectorBuffer + TC_BOOT_SECTOR_USER_MESSAGE_OFFSET, TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH);
                     54:        CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH] = 0;
                     55: 
                     56:        if (userConfig & TC_BOOT_USER_CFG_FLAG_SILENT_MODE)
                     57:        {
                     58:                if (CustomUserMessage[0])
1.1.1.9 ! root       59:                {
        !            60:                        InitVideoMode();
1.1.1.3   root       61:                        Print (CustomUserMessage);
1.1.1.9 ! root       62:                }
        !            63: 
1.1.1.3   root       64:                DisableScreenOutput();
                     65:        }
1.1.1.8   root       66: 
1.1.1.4   root       67:        OuterVolumeBackupHeaderCrc = *(uint32 *) (SectorBuffer + TC_BOOT_SECTOR_OUTER_VOLUME_BAK_HEADER_CRC_OFFSET);
1.1.1.3   root       68: 
                     69: ret:
                     70:        ReleaseSectorBuffer();
                     71: }
                     72: 
                     73: 
1.1.1.2   root       74: BiosResult UpdateBootSectorConfiguration (byte drive)
                     75: {
                     76:        AcquireSectorBuffer();
                     77: 
                     78:        BiosResult result = ReadWriteMBR (false, drive);
                     79:        if (result != BiosResultSuccess)
                     80:                goto ret;
                     81: 
                     82:        SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags;
                     83:        result = ReadWriteMBR (true, drive);
                     84: 
                     85: ret:
                     86:        ReleaseSectorBuffer();
                     87:        return result;
                     88: }
1.1.1.3   root       89: 
                     90: #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.