1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 11:08:02 -06:00

Windows: Add functionality to verify Rescue Disk ISO image file.

This commit is contained in:
Mounir IDRASSI
2015-09-16 01:17:03 +02:00
parent 52c7445a79
commit 9e1e128b14
6 changed files with 65 additions and 8 deletions

View File

@@ -1795,6 +1795,31 @@ namespace VeraCrypt
return false;
}
bool BootEncryption::VerifyRescueDiskIsoImage (const char* imageFile)
{
if (!RescueIsoImage)
throw ParameterIncorrect (SRC_POS);
try
{
File isoFile (imageFile, true);
isoFile.CheckOpened (SRC_POS);
size_t verifiedSectorCount = (TC_CD_BOOTSECTOR_OFFSET + TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET + TC_BOOT_LOADER_AREA_SIZE) / 2048;
Buffer buffer ((verifiedSectorCount + 1) * 2048);
DWORD bytesRead = isoFile.Read (buffer.Ptr(), (DWORD) buffer.Size());
if ( (bytesRead == buffer.Size())
&& (memcmp (buffer.Ptr(), RescueIsoImage, buffer.Size()) == 0)
)
{
return true;
}
}
catch (...) { }
return false;
}
#ifndef SETUP