VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Boot
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2018-12-18 23:34:31 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2018-12-18 23:41:30 (GMT)
commit6abc59acd204ce59f53b218cafc01ced955695cd (patch)
tree887cadf7534a8873f0f3e62775675b4422b10d1d /src/Boot
parent7ef3d5e36901231c3aa922d7f13b6f2bebbf9ca1 (diff)
downloadVeraCrypt-6abc59acd204ce59f53b218cafc01ced955695cd.zip
VeraCrypt-6abc59acd204ce59f53b218cafc01ced955695cd.tar.gz
Windows MBR Bootloader: workaround for issue affecting creation of hidden OS on some SSD drives (Error 128 while writing MBR). This commit replace the 512 bytes write operations by a 4096 bytes write operation.
Diffstat (limited to 'src/Boot')
-rw-r--r--src/Boot/Windows/BootConfig.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Boot/Windows/BootConfig.cpp b/src/Boot/Windows/BootConfig.cpp
index 6b28794..0412d08 100644
--- a/src/Boot/Windows/BootConfig.cpp
+++ b/src/Boot/Windows/BootConfig.cpp
@@ -85,14 +85,29 @@ ret:
BiosResult UpdateBootSectorConfiguration (byte 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();