[core] make sure the main partition size is aligned to the cluster size

* Having NTFS partitions properly aligned to the cluster size can drastically
  improve the speed of capturing a disk to an FFU image, as, when the size
  is aligned, the FFU capture uses the actual NTFS allocation map to only read
  and capture the clusters that are actually in use, whereas, if no aligned,
  FFU capture falls back to a sector by sector copy that is both much slower
  and also includes unwanted leftover garbage.
* Also only enable FFU when we detect FFUProvider.dll as a system library.
This commit is contained in:
Pete Batard 2023-07-04 13:26:04 +01:00
parent 0b1c68635a
commit 10dbfdd7e1
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
3 changed files with 24 additions and 14 deletions

View file

@ -1023,10 +1023,9 @@ void SaveVHD(void)
static_sprintf(filename, "%s.vhdx", rufus_drive[DriveIndex].label);
img_save.DeviceNum = (DWORD)ComboBox_GetItemData(hDeviceList, DriveIndex);
img_save.DevicePath = GetPhysicalName(img_save.DeviceNum);
// FFU support started with Windows 10 1709 (build 16299) and requires GPT
// TODO: Better check for FFU compatibility
if (WindowsVersion.Major < 10 || WindowsVersion.BuildNumber < 16299 ||
SelectedDrive.PartitionStyle != PARTITION_STYLE_GPT)
// FFU support started with Windows 10 1709 (through FfuProvider.dll) and requires GPT
static_sprintf(path, "%s\\dism\\FfuProvider.dll", sysnative_dir);
if ((_accessU(path, 0) != 0) || SelectedDrive.PartitionStyle != PARTITION_STYLE_GPT)
img_ext.count = 2;
img_save.ImagePath = FileDialog(TRUE, NULL, &img_ext, 0);
img_save.Type = VIRTUAL_STORAGE_TYPE_DEVICE_VHD;