diff options
Diffstat (limited to 'src/Boot/Windows/BootConfig.cpp')
-rw-r--r-- | src/Boot/Windows/BootConfig.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/Boot/Windows/BootConfig.cpp b/src/Boot/Windows/BootConfig.cpp index 3e41d610..948dfd93 100644 --- a/src/Boot/Windows/BootConfig.cpp +++ b/src/Boot/Windows/BootConfig.cpp @@ -3,20 +3,20 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ #include "BootConfig.h" -byte BootSectorFlags; +uint8 BootSectorFlags; -byte BootLoaderDrive; -byte BootDrive; +uint8 BootLoaderDrive; +uint8 BootDrive; bool BootDriveGeometryValid = false; bool PreventNormalSystemBoot = false; bool PreventBootMenu = false; char CustomUserMessage[TC_BOOT_SECTOR_USER_MESSAGE_MAX_LENGTH + 1]; @@ -38,9 +38,9 @@ uint64 HiddenVolumeStartSector; #ifndef TC_WINDOWS_BOOT_RESCUE_DISK_MODE void ReadBootSectorUserConfiguration () { - byte userConfig; + uint8 userConfig; AcquireSectorBuffer(); if (ReadWriteMBR (false, BootLoaderDrive, true) != BiosResultSuccess) @@ -82,18 +82,33 @@ ret: ReleaseSectorBuffer(); } -BiosResult UpdateBootSectorConfiguration (byte drive) +BiosResult UpdateBootSectorConfiguration (uint8 drive) { - AcquireSectorBuffer(); + uint64 mbrSector; + mbrSector.HighPart = 0; + mbrSector.LowPart = 0; + AcquireSectorBuffer(); +/* BiosResult result = ReadWriteMBR (false, drive); if (result != BiosResultSuccess) goto ret; SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags; result = ReadWriteMBR (true, drive); +*/ + + BiosResult result = ReadWriteSectors (false, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, mbrSector, 8, false); + if (result != BiosResultSuccess) + goto ret; + + CopyMemory (TC_BOOT_LOADER_BUFFER_SEGMENT, 0, SectorBuffer, TC_LB_SIZE); + SectorBuffer[TC_BOOT_SECTOR_CONFIG_OFFSET] = BootSectorFlags; + CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT,0, TC_LB_SIZE); + + result = ReadWriteSectors (true, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, mbrSector, 8, false); ret: ReleaseSectorBuffer(); return result; |