[ui] increase projected size to prevent persistence overflow

* If users set the persistent size to max, we may run into a situation
  where projected size (which is always a rough estimation) is too low.
* When persistence is in use, we increase the projected size by 10%, to
  ensure that the above scenario cannot happen.
* Also work around potential issues with Windows APIs when the application
  is launched from the root of a drive.
This commit is contained in:
Pete Batard 2021-06-10 17:18:40 +01:00
parent 9d7e96e293
commit 4f97cdfdc3
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
5 changed files with 20 additions and 10 deletions

View file

@ -726,7 +726,7 @@ void SetPersistenceSize(void)
uint64_t max = 0, pos = 0;
if (ComboBox_GetCurSel(hDeviceList) >= 0) {
max = SelectedDrive.DiskSize - img_report.projected_size;
max = SelectedDrive.DiskSize - PERCENTAGE(PROJECTED_SIZE_RATIO, img_report.projected_size);
persistence_size = min(persistence_size, max);
pos = persistence_size;