VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Boot/Windows/BootEncryptedIo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Boot/Windows/BootEncryptedIo.cpp')
-rw-r--r--src/Boot/Windows/BootEncryptedIo.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Boot/Windows/BootEncryptedIo.cpp b/src/Boot/Windows/BootEncryptedIo.cpp
index 25fe1dc4..8ca55635 100644
--- a/src/Boot/Windows/BootEncryptedIo.cpp
+++ b/src/Boot/Windows/BootEncryptedIo.cpp
@@ -108,10 +108,22 @@ 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, true);
+ if (BiosResultTimeout == result)
+ {
+ if (BiosResultSuccess == ReadWriteSectors (false, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, sector + writeOffset, 8, false))
+ {
+ CopyMemory (SectorBuffer, TC_BOOT_LOADER_BUFFER_SEGMENT,0, TC_LB_SIZE);
+ result = ReadWriteSectors (true, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, sector + writeOffset, 8, true);
+ }
+ }
if (result != BiosResultSuccess)
+ {
+ sector += writeOffset;
+ PrintDiskError (result, true, drive, &sector);
break;
+ }
++sector;
++dataUnitNo;