[cmp] add support for Ventoy Sparse Image (.vtsi)

This commit is contained in:
longpanda 2021-06-22 19:05:29 +01:00 committed by Pete Batard
parent 4f97cdfdc3
commit 49eefa2e03
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
13 changed files with 229 additions and 25 deletions

View file

@ -1961,22 +1961,22 @@ DWORD WINAPI FormatThread(void* param)
if ((boot_type == BT_IMAGE) && write_as_image) {
WriteDrive(hPhysicalDrive, FALSE);
// Trying to mount accessible partitions after writing an image leads to the
// creation of the infamous 'System Volume Information' folder on ESPs, which
// in turn leads to checksum errors for Ubuntu's boot/grub/efi.img (that maps
// to the Ubuntu ESP). So we no longer call on the code below...
#if 0
// If the image contains a partition we might be able to access, try to re-mount it
safe_unlockclose(hPhysicalDrive);
safe_unlockclose(hLogicalVolume);
Sleep(200);
WaitForLogical(DriveIndex, 0);
if (GetDrivePartitionData(SelectedDrive.DeviceNumber, fs_name, sizeof(fs_name), TRUE)) {
volume_name = GetLogicalName(DriveIndex, 0, TRUE, TRUE);
if ((volume_name != NULL) && (MountVolume(drive_name, volume_name)))
uprintf("Remounted %s as %C:", volume_name, drive_name[0]);
// Trying to mount accessible partitions after writing an image leads to the
// creation of the infamous 'System Volume Information' folder on ESPs, which
// in turn leads to checksum errors for Ubuntu's boot/grub/efi.img (that maps
// to the Ubuntu ESP). So we only call the code below for Ventoy's vtsi images.
if (img_report.compression_type == BLED_COMPRESSION_VTSI) {
// If the image contains a partition we might be able to access, try to re-mount it
safe_unlockclose(hPhysicalDrive);
safe_unlockclose(hLogicalVolume);
Sleep(200);
WaitForLogical(DriveIndex, 0);
if (GetDrivePartitionData(SelectedDrive.DeviceNumber, fs_name, sizeof(fs_name), TRUE)) {
volume_name = GetLogicalName(DriveIndex, 0, TRUE, TRUE);
if ((volume_name != NULL) && (MountVolume(drive_name, volume_name)))
uprintf("Remounted %s as %C:", volume_name, drive_name[0]);
}
}
#endif
goto out;
}