--- truecrypt/boot/windows/bootmain.cpp 2018/04/24 16:58:55 1.1.1.6 +++ truecrypt/boot/windows/bootmain.cpp 2018/04/24 17:03:51 1.1.1.9 @@ -1,7 +1,7 @@ /* - Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. + Copyright (c) 2008-2009 TrueCrypt Foundation. All rights reserved. - Governed by the TrueCrypt License 2.6 the full text of which is contained + Governed by the TrueCrypt License 2.7 the full text of which is contained in the file License.txt included in TrueCrypt binary and source code distribution packages. */ @@ -30,13 +30,17 @@ static void InitScreen () { ClearScreen(); - Print ( + const char *title = #ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE " TrueCrypt Boot Loader " #else " TrueCrypt Rescue Disk " #endif - VERSION_STRING " Copyright (C) 2008 TrueCrypt Foundation\r\n"); + VERSION_STRING; + + Print (title); + PrintRepeatedChar (' ', title[26] ? 8 : 9); + Print ("Copyright (C) 2008-2009 TrueCrypt Foundation\r\n"); PrintRepeatedChar ('\xDC', TC_BIOS_MAX_CHARS_PER_LINE); @@ -213,13 +217,16 @@ static void ExecuteBootSector (byte driv __asm { cli - mov dl, drive + mov dl, drive // Boot drive + mov dh, 0 xor ax, ax + mov si, ax mov ds, ax mov es, ax mov ss, ax - mov sp, 0xffff + mov sp, 0x7c00 sti + jmp cs:addr } } @@ -297,16 +304,7 @@ static bool CheckMemoryRequirements () } Print (memFree); - - Print ("\r\nThis is not a bug in TrueCrypt.\r\n" - "- Disable unneeded components (RAID, AHCI) in BIOS setup menu\r\n" - " (invoked by pressing Del or F2 after turning on your computer)\r\n"); -#ifndef TC_WINDOWS_BOOT_AES - Print ("- Use the AES encryption algorithm to reduce memory requirements\r\n"); -#endif -#ifdef TC_WINDOWS_BOOT_RESCUE_DISK_MODE - Print ("- Boot from HDD\r\n"); -#endif + PrintEndl(); Print (TC_BOOT_STR_UPGRADE_BIOS); return false; @@ -468,6 +466,7 @@ static void BootMenu () // NTFS/FAT partitions must have the boot indicator set to be considered bootable. if (!partition.Active && (*(uint32 *) (SectorBuffer + 3) == 0x5346544e // 'NTFS' + || *(uint32 *) (SectorBuffer + 3) == 0x41465845 && SectorBuffer[7] == 'T' // 'exFAT' || *(uint16 *) (SectorBuffer + 54) == 0x4146 && SectorBuffer[56] == 'T' // 'FAT' || *(uint16 *) (SectorBuffer + 82) == 0x4146 && SectorBuffer[84] == 'T')) { @@ -565,8 +564,11 @@ static bool CopyActivePartitionToHiddenV AcquireSectorBuffer(); if (ReadSectors (SectorBuffer, PartitionFollowingActive.Drive, PartitionFollowingActive.EndSector - (TC_VOLUME_HEADER_GROUP_SIZE / TC_LB_SIZE - 2), 1) != BiosResultSuccess - || (uint16) GetCrc32 (SectorBuffer, sizeof (SectorBuffer)) != OuterVolumeBackupHeaderCrc) + || GetCrc32 (SectorBuffer, sizeof (SectorBuffer)) != OuterVolumeBackupHeaderCrc) { + if (!IsLbaSupported (PartitionFollowingActive.Drive)) + Print ("BIOS: LBA N/A\r\n"); + PrintError ("Your BIOS does not support large drives"); Print (TC_BOOT_STR_UPGRADE_BIOS); @@ -582,11 +584,7 @@ static bool CopyActivePartitionToHiddenV sectorsRemaining = EncryptedVirtualPartition.SectorCount; if (!(sectorsRemaining == ActivePartition.SectorCount)) - { - PrintError ("Hidden volume size differs from system partition"); - crypto_close (BootCryptoInfo); - goto err; - } + TC_THROW_FATAL_EXCEPTION; InitScreen(); Print ("\r\nCopying system to hidden volume. To abort, press Esc.\r\n\r\n"); @@ -604,7 +602,11 @@ static bool CopyActivePartitionToHiddenV fragmentSectorCount = sectorsRemaining.LowPart; if (ReadWriteSectors (false, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, ActivePartition.StartSector + sectorOffset, fragmentSectorCount, false) != BiosResultSuccess) - break; + { + Print ("To fix bad sectors: 1) Terminate 2) Encrypt and decrypt sys partition 3) Retry\r\n"); + crypto_close (BootCryptoInfo); + goto err; + } AcquireSectorBuffer(); @@ -621,7 +623,10 @@ static bool CopyActivePartitionToHiddenV ReleaseSectorBuffer(); if (ReadWriteSectors (true, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, HiddenVolumeStartSector + sectorOffset, fragmentSectorCount, false) != BiosResultSuccess) - break; + { + crypto_close (BootCryptoInfo); + goto err; + } sectorsRemaining = sectorsRemaining - fragmentSectorCount; sectorOffset = sectorOffset + fragmentSectorCount;