mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Windows: Correctly detect presence of CD/DVD recorder during the creation of Rescue Disk. Check only CD/DVD drives and removable media when looking for rescue disk during its verification.
This commit is contained in:
@@ -1742,18 +1742,20 @@ namespace VeraCrypt
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool BootEncryption::IsCDDrivePresent ()
|
bool BootEncryption::IsCDRecorderPresent ()
|
||||||
{
|
{
|
||||||
for (char drive = 'Z'; drive >= 'C'; --drive)
|
ICDBurn* pICDBurn;
|
||||||
{
|
BOOL bHasRecorder = FALSE;
|
||||||
string path = "X:\\";
|
|
||||||
path[0] = drive;
|
|
||||||
|
|
||||||
if (GetDriveType (path.c_str()) == DRIVE_CDROM)
|
if (SUCCEEDED( CoCreateInstance (CLSID_CDBurn, NULL,CLSCTX_INPROC_SERVER,IID_ICDBurn,(LPVOID*)&pICDBurn)))
|
||||||
return true;
|
{
|
||||||
|
if (pICDBurn->HasRecordableDrive (&bHasRecorder) != S_OK)
|
||||||
|
{
|
||||||
|
bHasRecorder = FALSE;
|
||||||
}
|
}
|
||||||
|
pICDBurn->Release();
|
||||||
return false;
|
}
|
||||||
|
return bHasRecorder? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1766,10 +1768,15 @@ namespace VeraCrypt
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string path = "X:";
|
char rootPath[4] = { drive, ':', '\\', 0};
|
||||||
path[0] = drive;
|
UINT driveType = GetDriveTypeA (rootPath);
|
||||||
|
// check that it is a CD/DVD drive or a removable media in case a bootable
|
||||||
|
// USB key was created from the rescue disk ISO file
|
||||||
|
if ((DRIVE_CDROM == driveType) || (DRIVE_REMOVABLE == driveType))
|
||||||
|
{
|
||||||
|
rootPath[2] = 0; // remove trailing backslash
|
||||||
|
|
||||||
Device driveDevice (path, true);
|
Device driveDevice (rootPath, true);
|
||||||
driveDevice.CheckOpened (SRC_POS);
|
driveDevice.CheckOpened (SRC_POS);
|
||||||
size_t verifiedSectorCount = (TC_CD_BOOTSECTOR_OFFSET + TC_ORIG_BOOT_LOADER_BACKUP_SECTOR_OFFSET + TC_BOOT_LOADER_AREA_SIZE) / 2048;
|
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);
|
Buffer buffer ((verifiedSectorCount + 1) * 2048);
|
||||||
@@ -1781,6 +1788,7 @@ namespace VeraCrypt
|
|||||||
if (memcmp (buffer.Ptr(), RescueIsoImage, buffer.Size()) == 0)
|
if (memcmp (buffer.Ptr(), RescueIsoImage, buffer.Size()) == 0)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (...) { }
|
catch (...) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ namespace VeraCrypt
|
|||||||
void InstallBootLoader (bool preserveUserConfig = false, bool hiddenOSCreation = false);
|
void InstallBootLoader (bool preserveUserConfig = false, bool hiddenOSCreation = false);
|
||||||
bool CheckBootloaderFingerprint (bool bSilent = false);
|
bool CheckBootloaderFingerprint (bool bSilent = false);
|
||||||
void InvalidateCachedSysDriveProperties ();
|
void InvalidateCachedSysDriveProperties ();
|
||||||
bool IsCDDrivePresent ();
|
bool IsCDRecorderPresent ();
|
||||||
bool IsHiddenSystemRunning ();
|
bool IsHiddenSystemRunning ();
|
||||||
bool IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
|
bool IsPagingFileActive (BOOL checkNonWindowsPartitionsOnly);
|
||||||
void PrepareHiddenOSCreation (int ea, int mode, int pkcs5);
|
void PrepareHiddenOSCreation (int ea, int mode, int pkcs5);
|
||||||
|
|||||||
@@ -7779,7 +7779,7 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
retryCDDriveCheck:
|
retryCDDriveCheck:
|
||||||
if (!bDontVerifyRescueDisk && !BootEncObj->IsCDDrivePresent())
|
if (!bDontVerifyRescueDisk && !BootEncObj->IsCDRecorderPresent())
|
||||||
{
|
{
|
||||||
char *multiChoiceStr[] = { 0, "CD_BURNER_NOT_PRESENT",
|
char *multiChoiceStr[] = { 0, "CD_BURNER_NOT_PRESENT",
|
||||||
"CD_BURNER_NOT_PRESENT_WILL_STORE_ISO",
|
"CD_BURNER_NOT_PRESENT_WILL_STORE_ISO",
|
||||||
|
|||||||
Reference in New Issue
Block a user