VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Boot/Windows/BootEncryptedIo.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-11-09 00:24:17 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-11-09 00:26:28 +0100
commit8e9627877de933db8870492bd4d17bb019b0b563 (patch)
tree3499bbb794ab37a8d8909bad515c75ce8d78bf57 /src/Boot/Windows/BootEncryptedIo.cpp
parent3818b443c30676350207e546563bff3b69c464d5 (diff)
downloadVeraCrypt-8e9627877de933db8870492bd4d17bb019b0b563.tar.gz
VeraCrypt-8e9627877de933db8870492bd4d17bb019b0b563.zip
Windows MBR Bootloader: better way to handle displaying write errors in WriteEncryptedSectors function
Diffstat (limited to 'src/Boot/Windows/BootEncryptedIo.cpp')
-rw-r--r--src/Boot/Windows/BootEncryptedIo.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Boot/Windows/BootEncryptedIo.cpp b/src/Boot/Windows/BootEncryptedIo.cpp
index 380d3419..8ca55635 100644
--- a/src/Boot/Windows/BootEncryptedIo.cpp
+++ b/src/Boot/Windows/BootEncryptedIo.cpp
@@ -108,19 +108,22 @@ BiosResult WriteEncryptedSectors (uint16 sourceSegment, uint16 sourceOffset, byt
EncryptDataUnits (SectorBuffer, &dataUnitNo, 1, BootCryptoInfo);
}
- result = ReadWriteSectors (true, SectorBuffer, drive, sector + writeOffset, 1, false);
+ result = ReadWriteSectors (true, SectorBuffer, drive, sector + writeOffset, 1, true);
if (BiosResultTimeout == result)
{
- result = ReadWriteSectors (false, TC_BOOT_LOADER_BUFFER_SEGMENT, 0, drive, sector + writeOffset, 8, false);
- if (BiosResultSuccess == 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, false);
+ 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;