VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Boot/Windows/BootEncryptedIo.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-11-04 23:21:42 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-11-07 00:47:52 +0100
commit21392ef30ddb383445783b1786541015cb937b37 (patch)
tree42f9be623866441e2eebb33007896e2951e858dd /src/Boot/Windows/BootEncryptedIo.cpp
parentdc08b692401afdace6de02d81feb68cbf0752e12 (diff)
downloadVeraCrypt-21392ef30ddb383445783b1786541015cb937b37.tar.gz
VeraCrypt-21392ef30ddb383445783b1786541015cb937b37.zip
Windows MBR Bootloader: workaround for SSD disks that don't allow write operations in BIOS mode with buffers less than 4096 bytes
Diffstat (limited to 'src/Boot/Windows/BootEncryptedIo.cpp')
-rw-r--r--src/Boot/Windows/BootEncryptedIo.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Boot/Windows/BootEncryptedIo.cpp b/src/Boot/Windows/BootEncryptedIo.cpp
index 25fe1dc4..380d3419 100644
--- a/src/Boot/Windows/BootEncryptedIo.cpp
+++ b/src/Boot/Windows/BootEncryptedIo.cpp
@@ -108,7 +108,16 @@ BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byt
EncryptDataUnits (SectorBuffer, &dataUnitNo, 1, BootCryptoInfo);
}
- result = WriteSectors (SectorBuffer, drive, sector + writeOffset, 1);
+ result = ReadWriteSectors (true, SectorBuffer, drive, sector + writeOffset, 1, false);
+ if (BiosResultTimeout == result)
+ {
+ result = ReadWriteSectors (false, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, sector + writeOffset, 8, false);
+ if (BiosResultSuccess == result)
+ {
+ CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT,0, TC_LB_SIZE);
+ result = ReadWriteSectors (true, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, sector + writeOffset, 8, false);
+ }
+ }
if (result != BiosResultSuccess)
break;