diff --git a/INSTALL/Ventoy2Disk.exe b/INSTALL/Ventoy2Disk.exe index 8af8442b..76c1080d 100644 Binary files a/INSTALL/Ventoy2Disk.exe and b/INSTALL/Ventoy2Disk.exe differ diff --git a/INSTALL/Ventoy2Disk_ARM.exe b/INSTALL/Ventoy2Disk_ARM.exe index 47a65121..55fd7652 100644 Binary files a/INSTALL/Ventoy2Disk_ARM.exe and b/INSTALL/Ventoy2Disk_ARM.exe differ diff --git a/INSTALL/Ventoy2Disk_ARM64.exe b/INSTALL/Ventoy2Disk_ARM64.exe index fa844917..47727bd0 100644 Binary files a/INSTALL/Ventoy2Disk_ARM64.exe and b/INSTALL/Ventoy2Disk_ARM64.exe differ diff --git a/INSTALL/Ventoy2Disk_X64.exe b/INSTALL/Ventoy2Disk_X64.exe index 924df5ab..88fd2520 100644 Binary files a/INSTALL/Ventoy2Disk_X64.exe and b/INSTALL/Ventoy2Disk_X64.exe differ diff --git a/LANGUAGES/languages.json b/LANGUAGES/languages.json index 13511f1e..a1075793 100644 --- a/LANGUAGES/languages.json +++ b/LANGUAGES/languages.json @@ -48,6 +48,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -99,6 +105,12 @@ "STR_VTSI_CREATE_TIP":"이번에는 장치에 쓰지 않고 VTSI 파일#@만 생성합니다.#@계속하시겠습니까?", "STR_VTSI_CREATE_SUCCESS":"VTSI 파일이 성공적으로 생성되었습니다!#@Rufus(3.15+)를 사용하여 장치에 기록하여 Ventoy 설치를 완료할 수 있습니다.", "STR_VTSI_CREATE_FAILED":"VTSI 파일을 생성하지 못했습니다.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -150,6 +162,12 @@ "STR_VTSI_CREATE_TIP":"本操作不会向设备中写入数据,而只会生成一个 VTSI 文件#@是否继续?", "STR_VTSI_CREATE_SUCCESS":"VTSI 文件创建成功,你可以使用Rufus(3.15+)将其写入对应设备,从而完成Ventoy的安装", "STR_VTSI_CREATE_FAILED":"VTSI 文件创建失败", + "STR_MENU_PART_RESIZE":"无损安装", + "STR_PART_RESIZE_TIP":"Ventoy将尝试进行无损安装。注意:任何磁盘操作都有一定的风险,对于重要数据建议做好备份。#@是否继续?", + "STR_PART_RESIZE_SUCCESS":"恭喜你! Ventoy 成功完成了无损安装。", + "STR_PART_RESIZE_FAILED":"Ventoy 无损安装失败。详细信息请查阅 log.txt 文件。", + "STR_PART_RESIZE_UNSUPPORTED":"条件不满足,无法进行无损安装。详细信息请查阅 log.txt 文件。", + "STRXXX":"" }, { @@ -201,6 +219,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -252,6 +276,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -303,6 +333,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -354,6 +390,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -405,6 +447,12 @@ "STR_VTSI_CREATE_TIP":"Şu an aygıta yazılmayacak,sadece bir VTSI dosyası oluşturulacak#@Devam edilsin mi?", "STR_VTSI_CREATE_SUCCESS":"VTSI dosyası başarılı bir şekilde oluşturuldu!#@Ventoy'un aygıta kurulumunu tamamlamak için Rufus(3.15+) programını kullanabilirsiniz.", "STR_VTSI_CREATE_FAILED":"VTSI dosyası oluşturma başarısız oldu!", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -456,6 +504,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -507,6 +561,12 @@ "STR_VTSI_CREATE_TIP":"Aqueste còp cap d’escritura al disc, generacion del fichiet VTSI sonque#@Contunhar ?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"Fracàs de la creacion del fichièr VTSI.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -558,6 +618,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -609,6 +675,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -660,6 +732,12 @@ "STR_VTSI_CREATE_TIP":"Esta vez no se escribirá al dispositivo, pero solo generará un archivo VTSI#@¿Continuar?", "STR_VTSI_CREATE_SUCCESS":"¡Archivo VTSI creado exitosamente!#@Puedes usar Rufus(3.15+) para escribirlo al dispositivo a fin de completar la instalación de Ventoy.", "STR_VTSI_CREATE_FAILED":"Fallo en el archivo VTSI creado.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -711,6 +789,12 @@ "STR_VTSI_CREATE_TIP":"На этот раз Ventoy не будет установлен на устройство, а будет только создан файл VTSI#@Продолжить?", "STR_VTSI_CREATE_SUCCESS":"Файл VTSI создан успешно!#@Вы можете использовать Rufus(3.15+), чтобы записать его на устройство, для завершения установки Ventoy.", "STR_VTSI_CREATE_FAILED":"Ошибка создания файла VTSI.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -762,6 +846,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -813,6 +903,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -864,6 +960,12 @@ "STR_VTSI_CREATE_TIP":"Deze keer wordt er niet naar het apparaat geschreven, maar wordt er alleen een VTSI-bestand gegenereerd#@Doorgaan?", "STR_VTSI_CREATE_SUCCESS":"VTSI-bestand met succes aangemaakt!#@U kunt Rufus(3.15+) gebruiken om het bestand naar het apparaat te schrijven om de installatie van Ventoy te voltooien.", "STR_VTSI_CREATE_FAILED":"Aanmaken van VTSI-bestand mislukt.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -915,6 +1017,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -966,6 +1074,12 @@ "STR_VTSI_CREATE_TIP":"VTSIファイルを生成し,記憶装置への書き込みは行いません。#@続行しますか?", "STR_VTSI_CREATE_SUCCESS":"VTSIファイルが生成されました。#@Rufus(3.15以上の版)を使って記憶装置に書き込んで,Ventoyの導入を完遂しましょう。", "STR_VTSI_CREATE_FAILED":"VTSIファイルを生成できませんでした。", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1017,6 +1131,12 @@ "STR_VTSI_CREATE_TIP":"Questa volta non scriverà sul dispositivo, ma genererà solo un file VTSI#@Continuare?", "STR_VTSI_CREATE_SUCCESS":"File VTSI creato con successo!#@Puoi usare Rufus (versione 3.15 o successiva) per scrivere sul dispositivo in modo da completare l'installazione di Ventoy.", "STR_VTSI_CREATE_FAILED":"Creazione File VTSI non riuscito.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1068,6 +1188,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1119,6 +1245,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1170,6 +1302,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1221,6 +1359,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1272,6 +1416,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1323,6 +1473,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1374,6 +1530,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1421,10 +1583,16 @@ "STR_WEB_SERVICE_UNAVAILABLE":"Lỗi giao tiếp: Dịch vụ không sẵn có", "STR_WEB_TOKEN_MISMATCH":"Đã cập nhật trạng thái Daemon, vui lòng thử lại sau.", "STR_WEB_SERVICE_BUSY":"Dịch vụ bận, vui lòng thử lại sau.", - "STR_MENU_VTSI_CREATE":"Tạo tệp VTSI", + "STR_MENU_VTSI_CREATE":"Tạo tệp VTSI", "STR_VTSI_CREATE_TIP":"Lần này sẽ không ghi vào thiết bị, chỉ tạo một tệp VTSI#@Bạn muốn tiếp tục?", "STR_VTSI_CREATE_SUCCESS":"Tạo tệp VTSI thành công!#@Để hoàn thành cài đặt Ventoy, bạn có thể dùng Rufus (3.15+) để ghi tệp này vào thiết bị.", "STR_VTSI_CREATE_FAILED":"Tạo tệp VTSI đã gặp lỗi.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1476,6 +1644,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1527,6 +1701,12 @@ "STR_VTSI_CREATE_TIP":"Овој пат ништо нема да се запише на уредот туку само ќе се генерира VTSI датотека#@Продолжи?", "STR_VTSI_CREATE_SUCCESS":"Успешно креирана VTSI датотека!#@Можете да го користите Rufus(3.15+) за да ја запишете на уредот како и да ја комплетирате инсталацијата на Ventoy.", "STR_VTSI_CREATE_FAILED":"Креирањето на VTSI датотека е неуспешно.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1578,6 +1758,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1629,6 +1815,12 @@ "STR_VTSI_CREATE_TIP":"Desta vez não irá gravar no dispositivo, mas apenas gerar um ficheiro VTSI#@Continuar?", "STR_VTSI_CREATE_SUCCESS":"Ficheiro VTSI criado com sucesso!#@Pode utilizar o Rufus(3.15+) para o gravar no dispositivo de modo a completar a instalação do Ventoy.", "STR_VTSI_CREATE_FAILED":"Falha no ficheiro VTSI criado.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1680,6 +1872,12 @@ "STR_VTSI_CREATE_TIP":"Saat ini tidak akan menuliskan di perangkat, tetapi hanya membuat berkas VTSI #@Lanjutkan?", "STR_VTSI_CREATE_SUCCESS":"Berkas VTSI berhasil dibuat#@Anda bisa menggunakan Rufus(3.15+) untuk menulisnya ke perangkat untuk menyelesaikan instalasi Ventoy.", "STR_VTSI_CREATE_FAILED":"Berkas VTSI gagal dibuat.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1731,6 +1929,12 @@ "STR_VTSI_CREATE_TIP":"Dette vil ikke skrive til enheten, men kun generere en VTSIfil#@Fortsett?", "STR_VTSI_CREATE_SUCCESS":"VTSI-fil opprettet.#@Du kan bruke Rufus(3.15+) til å skrive den til enheten for å fullføre installasjonen av Ventoy.", "STR_VTSI_CREATE_FAILED":"Noe gikk galt under opprettelse av VTSI-fil.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1782,6 +1986,12 @@ "STR_VTSI_CREATE_TIP":"Цього разу Ventoy не буде встановлено на пристрій, а лише буде створено файл VTSI#@Продовжити?", "STR_VTSI_CREATE_SUCCESS":"Файл VTSI створено успішно!#@Ви можете використати Rufus(3.15+), щоб записати його на пристрій, для завершення встановлення Ventoy", "STR_VTSI_CREATE_FAILED":"Не вдалося створити файл VTSI.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1833,6 +2043,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1884,6 +2100,12 @@ "STR_VTSI_CREATE_TIP":"Den här gången skrivs det inget till enheten, utan det skapas endast en VTSI-fil#@Fortsätta?", "STR_VTSI_CREATE_SUCCESS":"VTSI-filen skapad!#@Använd Rufus (3.15+) till att skriva till enheten för att slutföra installationen av Ventoy.", "STR_VTSI_CREATE_FAILED":"Misslyckades med att skapa VTSI-filen.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1935,6 +2157,12 @@ "STR_VTSI_CREATE_TIP":"This time will not write to the device, but only generate a VTSI file#@Continue?", "STR_VTSI_CREATE_SUCCESS":"VTSI file created successfully!#@You can use Rufus(3.15+) to write it to the device so as to complete the installation of Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI file created failed.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -1986,6 +2214,12 @@ "STR_VTSI_CREATE_TIP":"Сега няма да се записва на диска, само ще се генерира VTSI файл#@Продължаваме?", "STR_VTSI_CREATE_SUCCESS":"VTSI файла бе създаден успешно!#@Може да използвате Rufus(3.15+) да го запишете на устройството за инсталацията с Ventoy.", "STR_VTSI_CREATE_FAILED":"VTSI файла създаване се провали.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -2037,6 +2271,12 @@ "STR_VTSI_CREATE_TIP":"Այս անգամ չի գրվի կրիչի վրա, այլ միայն կստեղծվի VTSI ֆայլ#@Շարունակել?", "STR_VTSI_CREATE_SUCCESS":"VTSI ֆայլը հաջողությամբ ստեղծվեց!#@Դուք կարող եք օգտագործել Rufus (3.15+) կրիչում ձայնագրելու համար, որպեսզի ավարտեք Ventoy-ի տեղադրումը:", "STR_VTSI_CREATE_FAILED":"VTSI ֆայլի ստեղծումը ձախողվեց։", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" }, { @@ -2088,6 +2328,12 @@ "STR_VTSI_CREATE_TIP":"Tällä kerralla laitteeseen ei kirjoiteta, vaan luodaan ainoastaan VTSI -tiedosto#@Jatketaanko?", "STR_VTSI_CREATE_SUCCESS":"VTSI -tiedosto luotiin onnistuneesti!#@Voit käyttää Rufus-ohjelmaa(3.15+) kirjoittaaksesi sen laitteeseen viimeistelläksesi Ventoy-asennuksen.", "STR_VTSI_CREATE_FAILED":"VTSI -tiedoston luominen epäonnistui.", + "STR_MENU_PART_RESIZE":"Non-destructive Install", + "STR_PART_RESIZE_TIP":"Ventoy will try non-destructive installation if possible. #@Continue?", + "STR_PART_RESIZE_SUCCESS":"Congratulations!#@Ventoy non-destructive installation successfully finished.", + "STR_PART_RESIZE_FAILED":"Non-destructive installation failed, Check log.txt for details.", + "STR_PART_RESIZE_UNSUPPORTED":"Ventoy non-destructive installation stopped because some conditions cannot be met. Check log.txt for details.", + "STRXXX":"" } -] +] \ No newline at end of file diff --git a/LinuxGUI/build_qt.sh b/LinuxGUI/build_qt.sh index dd5b44c1..df5fab57 100644 --- a/LinuxGUI/build_qt.sh +++ b/LinuxGUI/build_qt.sh @@ -157,7 +157,9 @@ if [ "$1" = "VENTOY_I386_QT_BUILD" ]; then exit 0 fi - +if [ ! -f /opt/CentOS8/LinuxGUI/build.sh ]; then + mount --bind /home/share/Ventoy/LinuxGUI /opt/CentOS8/LinuxGUI +fi chroot /opt/CentOS8 sh /buildqt.sh force_copy ./Ventoy2Disk.qt5_32 ../INSTALL/tool/i386/Ventoy2Disk.qt5 diff --git a/Ventoy2Disk/Ventoy2Disk/DiskService.h b/Ventoy2Disk/Ventoy2Disk/DiskService.h index 95b8bbc4..3ccbc999 100644 --- a/Ventoy2Disk/Ventoy2Disk/DiskService.h +++ b/Ventoy2Disk/Ventoy2Disk/DiskService.h @@ -42,6 +42,7 @@ BOOL VDS_CreateVtoyEFIPart(int DriveIndex, UINT64 Offset); BOOL VDS_ChangeVtoyEFI2ESP(int DriveIndex, UINT64 Offset); BOOL VDS_ChangeVtoyEFI2Basic(int DriveIndex, UINT64 Offset); BOOL VDS_FormatVtoyEFIPart(int DriveIndex, UINT64 Offset); +BOOL VDS_ShrinkVolume(const char* VolumeGuid, UINT64 ReduceBytes); //diskpart.exe BOOL DSPT_CleanDisk(int DriveIndex); diff --git a/Ventoy2Disk/Ventoy2Disk/DiskService_vds.c b/Ventoy2Disk/Ventoy2Disk/DiskService_vds.c index 55fd70a8..c53cc44a 100644 --- a/Ventoy2Disk/Ventoy2Disk/DiskService_vds.c +++ b/Ventoy2Disk/Ventoy2Disk/DiskService_vds.c @@ -36,6 +36,10 @@ // 3. Filter out the crap we don't need. static const char *GetVdsError(DWORD error_code) { + static char code[32]; + + sprintf_s(code, sizeof(code), "[0x%08x]", error_code); + switch (error_code) { case 0x80042400: // VDS_E_NOT_SUPPORTED return "The operation is not supported by the object."; @@ -450,7 +454,7 @@ static const char *GetVdsError(DWORD error_code) case 0x80042918: // VDS_E_COMPRESSION_NOT_SUPPORTED return "The specified file system does not support compression."; default: - return NULL; + return code; } } @@ -537,6 +541,8 @@ const char *WindowsErrorString(DWORD error_code) #define INTF_ADVANCEDDISK2 2 #define INTF_CREATEPARTITIONEX 3 #define INTF_PARTITIONMF 4 +#define INTF_VOLUME 5 +#define INTF_VOLUME_MF3 6 /* * Some code and functions in the file are copied from rufus. @@ -588,6 +594,8 @@ const char *WindowsErrorString(DWORD error_code) #define IVdsAsync_Wait(This,pHrResult,pAsyncOut) (This)->lpVtbl->Wait(This,pHrResult,pAsyncOut) #define IVdsAsync_Release(This) (This)->lpVtbl->Release(This) +#define IVdsVolume_Shrink(This, ullNumberOfBytesToRemove, ppAsync) (This)->lpVtbl->Shrink(This, ullNumberOfBytesToRemove, ppAsync) + #define IUnknown_QueryInterface(This, a, b) (This)->lpVtbl->QueryInterface(This,a,b) #define IUnknown_Release(This) (This)->lpVtbl->Release(This) @@ -635,6 +643,162 @@ STATIC IVdsService * VDS_InitService(void) return pService; } +STATIC BOOL VDS_VolumeCommProc(int intf, const WCHAR* wVolumeGuid, VDS_Callback_PF callback, UINT64 data) +{ + int Pos = 0; + BOOL Find = FALSE; + BOOL r = FALSE; + HRESULT hr; + ULONG ulFetched; + IUnknown* pUnk = NULL; + IEnumVdsObject* pEnum = NULL; + IVdsService* pService = NULL; + + pService = VDS_InitService(); + if (!pService) + { + Log("Could not query VDS Service"); + goto out; + } + + // Query the VDS Service Providers + hr = IVdsService_QueryProviders(pService, VDS_QUERY_SOFTWARE_PROVIDERS, &pEnum); + if (hr != S_OK) + { + VDS_SET_ERROR(hr); + Log("Could not query VDS Service Providers: 0x%lx %u", hr, LASTERR); + goto out; + } + + while (IEnumVdsObject_Next(pEnum, 1, &pUnk, &ulFetched) == S_OK) + { + IVdsProvider* pProvider; + IVdsSwProvider* pSwProvider; + IEnumVdsObject* pEnumPack; + IUnknown* pPackUnk; + + // Get VDS Provider + hr = IUnknown_QueryInterface(pUnk, &IID_IVdsProvider, (void**)&pProvider); + IUnknown_Release(pUnk); + if (hr != S_OK) + { + VDS_SET_ERROR(hr); + Log("Could not get VDS Provider: %u", LASTERR); + goto out; + } + + // Get VDS Software Provider + hr = IVdsSwProvider_QueryInterface(pProvider, &IID_IVdsSwProvider, (void**)&pSwProvider); + IVdsProvider_Release(pProvider); + if (hr != S_OK) + { + VDS_SET_ERROR(hr); + Log("Could not get VDS Software Provider: %u", LASTERR); + goto out; + } + + // Get VDS Software Provider Packs + hr = IVdsSwProvider_QueryPacks(pSwProvider, &pEnumPack); + IVdsSwProvider_Release(pSwProvider); + if (hr != S_OK) + { + VDS_SET_ERROR(hr); + Log("Could not get VDS Software Provider Packs: %u", LASTERR); + goto out; + } + + // Enumerate Provider Packs + while (IEnumVdsObject_Next(pEnumPack, 1, &pPackUnk, &ulFetched) == S_OK) + { + IVdsPack* pPack; + IEnumVdsObject* pEnumVolume; + IUnknown* pVolumeUnk; + + hr = IUnknown_QueryInterface(pPackUnk, &IID_IVdsPack, (void**)&pPack); + IUnknown_Release(pPackUnk); + if (hr != S_OK) + { + VDS_SET_ERROR(hr); + Log("Could not query VDS Software Provider Pack: %u", LASTERR); + goto out; + } + + // Use the pack interface to access the volume + hr = IVdsPack_QueryVolumes(pPack, &pEnumVolume);; + if (hr != S_OK) { + VDS_SET_ERROR(hr); + Log("Could not query VDS volume: %u", LASTERR); + goto out; + } + + // List disks + while (IEnumVdsObject_Next(pEnumVolume, 1, &pVolumeUnk, &ulFetched) == S_OK) + { + IVdsVolume* pVolume; + IVdsVolumeMF3* pVolumeMF3; + LPWSTR* wszPathArray; + ULONG ulNumberOfPaths; + + // Get the disk interface. + hr = IUnknown_QueryInterface(pVolumeUnk, &IID_IVdsVolumeMF3, (void**)&pVolumeMF3); + if (hr != S_OK) { + VDS_SET_ERROR(hr); + Log("Could not query VDS Volume Interface: %u", LASTERR); + goto out; + } + + // Get the volume properties + hr = IVdsVolumeMF3_QueryVolumeGuidPathnames(pVolumeMF3, &wszPathArray, &ulNumberOfPaths); + if ((hr != S_OK) && (hr != VDS_S_PROPERTIES_INCOMPLETE)) + { + Log("Could not query VDS VolumeMF3 GUID PathNames: %s", GetVdsError(hr)); + IVdsVolume_Release(pVolumeMF3); + IUnknown_Release(pVolumeUnk); + continue; + } + + Log("Get Volume %d %lu <%S>", intf, ulNumberOfPaths, wszPathArray[0]); + + if ((ulNumberOfPaths >= 1) && wcsstr(wszPathArray[0], wVolumeGuid)) + { + Find = TRUE; + Log("Call back for this Volume %d <%S>", intf, wVolumeGuid); + + if (INTF_VOLUME_MF3 == intf) + { + r = callback(pVolumeMF3, NULL, data); + } + else if (INTF_VOLUME == intf) + { + // Get the disk interface. + hr = IUnknown_QueryInterface(pVolumeUnk, &IID_IVdsVolume, (void**)&pVolume); + if (hr != S_OK) { + VDS_SET_ERROR(hr); + Log("Could not query VDS Volume Interface: %u", LASTERR); + } + else { + r = callback(pVolume, NULL, data); + IVdsVolume_Release(pVolume); + } + } + } + + CoTaskMemFree(wszPathArray); + IVdsVolume_Release(pVolumeMF3); + IUnknown_Release(pVolumeUnk); + + if (Find) + { + goto out; + } + } + } + } + +out: + return r; +} + STATIC BOOL VDS_DiskCommProc(int intf, int DriveIndex, VDS_Callback_PF callback, UINT64 data) { @@ -1222,3 +1386,72 @@ BOOL VDS_FormatVtoyEFIPart(int DriveIndex, UINT64 Offset) return ret; } +STATIC BOOL VDS_CallBack_ShrinkVolume(void* pInterface, VDS_DISK_PROP* pDiskProp, UINT64 data) +{ + HRESULT hr, hr2; + IVdsVolume* pVolume = (IVdsVolume*)pInterface; + ULONG completed; + IVdsAsync* pAsync; + + (void)pDiskProp; + + Log("VDS_CallBack_ShrinkVolume (%llu) ...", (ULONGLONG)data); + + hr = IVdsVolume_Shrink(pVolume, (ULONGLONG)data, &pAsync); + + while (SUCCEEDED(hr)) + { + hr = IVdsAsync_QueryStatus(pAsync, &hr2, &completed); + if (SUCCEEDED(hr)) + { + hr = hr2; + if (hr == S_OK) + { + Log("ShrinkVolume QueryStatus OK, %lu%%", completed); + break; + } + else if (hr == VDS_E_OPERATION_PENDING) + { + Log("ShrinkVolume: %lu%%", completed); + hr = S_OK; + } + else + { + Log("ShrinkVolume invalid status:0x%lx", hr); + } + } + Sleep(1000); + } + + if (hr != S_OK) + { + VDS_SET_ERROR(hr); + Log("Could not ShrinkVolume, 0x%x err:0x%lx (%s)", hr, LASTERR, WindowsErrorString(hr)); + return FALSE; + } + + return TRUE; +} + +BOOL VDS_ShrinkVolume(const char* VolumeGuid, UINT64 ReduceBytes) +{ + int i; + BOOL ret = FALSE; + WCHAR wGuid[128] = { 0 }; + const char *guid = NULL; + + guid = strstr(VolumeGuid, "{"); + if (!guid) + { + return FALSE; + } + + for (i = 0; i < 128 && guid[i]; i++) + { + wGuid[i] = guid[i]; + } + + ret = VDS_VolumeCommProc(INTF_VOLUME, wGuid, VDS_CallBack_ShrinkVolume, ReduceBytes); + Log("VDS_ShrinkVolume ret:%d (%s)", ret, ret ? "SUCCESS" : "FAIL"); + return ret; +} \ No newline at end of file diff --git a/Ventoy2Disk/Ventoy2Disk/Language.h b/Ventoy2Disk/Ventoy2Disk/Language.h index 72491a38..00c4618d 100644 --- a/Ventoy2Disk/Ventoy2Disk/Language.h +++ b/Ventoy2Disk/Ventoy2Disk/Language.h @@ -77,6 +77,12 @@ typedef enum STR_ID STR_VTSI_CREATE_SUCCESS, //41 STR_VTSI_CREATE_FAILED, //42 + STR_MENU_PART_RESIZE,//43 + STR_PART_RESIZE_TIP,//44 + STR_PART_RESIZE_SUCCESS,//45 + STR_PART_RESIZE_FAILED,//46 + STR_PART_RESIZE_UNSUPPORTED,//47 + STR_ID_MAX }STR_ID; @@ -90,6 +96,7 @@ extern BOOL g_SecureBoot; #define VTOY_MENU_PART_GPT 0xA005 #define VTOY_MENU_ALL_DEV 0xA006 #define VTOY_MENU_VTSI 0xA007 +#define VTOY_MENU_PART_RESIZE 0xA008 typedef enum OPT_SUBMENU @@ -100,6 +107,7 @@ typedef enum OPT_SUBMENU OPT_SUBMENU_CLEAR, OPT_SUBMENU_ALL_DEV, OPT_SUBMENU_VTSI, + OPT_SUBMENU_PART_RESIZE, OPT_SUBMENU_MAX }OPT_SUBMENU; diff --git a/Ventoy2Disk/Ventoy2Disk/PhyDrive.c b/Ventoy2Disk/Ventoy2Disk/PhyDrive.c index 774cf9ca..182a718e 100644 --- a/Ventoy2Disk/Ventoy2Disk/PhyDrive.c +++ b/Ventoy2Disk/Ventoy2Disk/PhyDrive.c @@ -33,6 +33,34 @@ static int g_backup_bin_index = 0; + +static BOOL WriteDataToPhyDisk(HANDLE hDrive, UINT64 Offset, VOID *buffer, DWORD len) +{ + BOOL bRet; + DWORD dwSize = 0; + LARGE_INTEGER liCurPosition; + LARGE_INTEGER liNewPosition; + + liCurPosition.QuadPart = (LONGLONG)Offset; + liNewPosition.QuadPart = 0; + if (0 == SetFilePointerEx(hDrive, liCurPosition, &liNewPosition, FILE_BEGIN) || + liNewPosition.QuadPart != liCurPosition.QuadPart) + { + Log("SetFilePointerEx Failed %u", LASTERR); + return FALSE; + } + + bRet = WriteFile(hDrive, buffer, len, &dwSize, NULL); + if (bRet == FALSE || dwSize != len) + { + Log("Write file error %u %u", dwSize, LASTERR); + return FALSE; + } + + return TRUE; +} + + static DWORD GetVentoyVolumeName(int PhyDrive, UINT64 StartSectorId, CHAR *NameBuf, UINT32 BufLen, BOOL DelSlash) { size_t len; @@ -129,7 +157,7 @@ static int GetLettersBelongPhyDrive(int PhyDrive, char *DriveLetters, size_t Len for (Pos = StringBuf; *Pos; Pos += strlen(Pos) + 1) { - if (n < (int)Length && PhyDrive == GetPhyDriveByLogicalDrive(Pos[0])) + if (n < (int)Length && PhyDrive == GetPhyDriveByLogicalDrive(Pos[0], NULL)) { Log("%C: is belong to phydrive%d", Pos[0], PhyDrive); DriveLetters[n++] = Pos[0]; @@ -140,7 +168,7 @@ static int GetLettersBelongPhyDrive(int PhyDrive, char *DriveLetters, size_t Len return 0; } -static HANDLE GetPhysicalHandle(int Drive, BOOLEAN bLockDrive, BOOLEAN bWriteAccess, BOOLEAN bWriteShare) +HANDLE GetPhysicalHandle(int Drive, BOOLEAN bLockDrive, BOOLEAN bWriteAccess, BOOLEAN bWriteShare) { int i; DWORD dwSize; @@ -260,7 +288,7 @@ End: return hDrive; } -int GetPhyDriveByLogicalDrive(int DriveLetter) +int GetPhyDriveByLogicalDrive(int DriveLetter, UINT64 *Offset) { BOOL Ret; DWORD dwSize; @@ -301,6 +329,11 @@ int GetPhyDriveByLogicalDrive(int DriveLetter) DiskExtents.Extents[0].ExtentLength.QuadPart ); + if (Offset) + { + *Offset = (UINT64)(DiskExtents.Extents[0].StartingOffset.QuadPart); + } + return (int)DiskExtents.Extents[0].DiskNumber; } @@ -335,7 +368,7 @@ int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount) { if (dwBytes & 0x01) { - id = GetPhyDriveByLogicalDrive(Letter); + id = GetPhyDriveByLogicalDrive(Letter, NULL); Log("%C --> %d", Letter, id); if (id >= 0) { @@ -842,7 +875,7 @@ static int FormatPart2Fat(HANDLE hDrive, UINT64 StartSectorId) LARGE_INTEGER liNewPosition; BYTE *CheckBuf = NULL; - Log("FormatPart2Fat %llu...", StartSectorId); + Log("FormatPart2Fat %llu...", (ULONGLONG)StartSectorId); CheckBuf = malloc(SIZE_1MB); if (!CheckBuf) @@ -1830,6 +1863,269 @@ End: return rc; } + +int PartitionResizeForVentoy(PHY_DRIVE_INFO *pPhyDrive) +{ + int i, j; + int rc = 1; + int PhyDrive; + int PartStyle; + INT64 ReservedValue; + UINT64 RecudeBytes; + GUID Guid; + MBR_HEAD MBR; + VTOY_GPT_INFO *pGPT; + MBR_HEAD *pMBR; + DWORD dwSize = 0; + VTOY_GPT_HDR BackupHead; + HANDLE hDrive = INVALID_HANDLE_VALUE; + GUID ZeroGuid = { 0 }; + static GUID WindowsDataPartType = { 0xebd0a0a2, 0xb9e5, 0x4433, { 0x87, 0xc0, 0x68, 0xb6, 0xb7, 0x26, 0x99, 0xc7 } }; + static GUID EspPartType = { 0xc12a7328, 0xf81f, 0x11d2, { 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b } }; + static GUID BiosGrubPartType = { 0x21686148, 0x6449, 0x6e6f, { 0x74, 0x4e, 0x65, 0x65, 0x64, 0x45, 0x46, 0x49 } }; + + Log("#####################################################"); + Log("PartitionResizeForVentoy PhyDrive%d <<%s %s %dGB>>", + pPhyDrive->PhyDrive, pPhyDrive->VendorId, pPhyDrive->ProductId, + GetHumanReadableGBSize(pPhyDrive->SizeInBytes)); + Log("#####################################################"); + + pGPT = &(pPhyDrive->Gpt); + pMBR = &(pPhyDrive->Gpt.MBR); + Log("Disksize:%llu Part2Start:%llu", pPhyDrive->SizeInBytes, pPhyDrive->ResizePart2StartSector * 512); + + if (pMBR->PartTbl[0].FsFlag == 0xEE && memcmp(pGPT->Head.Signature, "EFI PART", 8) == 0) + { + PartStyle = 1; + } + else + { + PartStyle = 0; + } + + PROGRESS_BAR_SET_POS(PT_LOCK_FOR_CLEAN); + + RecudeBytes = VENTOY_EFI_PART_SIZE; + ReservedValue = GetReservedSpaceInMB(); + if (ReservedValue > 0) + { + Log("Reduce add reserved space %lldMB", (LONGLONG)ReservedValue); + RecudeBytes += (UINT64)(ReservedValue * SIZE_1MB); + } + + + if (pPhyDrive->ResizeNoShrink == FALSE) + { + Log("Need to shrink the volume"); + if (VDS_ShrinkVolume(pPhyDrive->ResizeVolumeGuid, RecudeBytes)) + { + Log("Shrink volume success, now check again"); + + hDrive = GetPhysicalHandle(pPhyDrive->PhyDrive, TRUE, TRUE, FALSE); + if (hDrive == INVALID_HANDLE_VALUE) + { + Log("Failed to GetPhysicalHandle for update."); + goto End; + } + + //Refresh Drive Layout + DeviceIoControl(hDrive, IOCTL_DISK_UPDATE_PROPERTIES, NULL, 0, NULL, 0, &dwSize, NULL); + + CHECK_CLOSE_HANDLE(hDrive); + + + if (PartResizePreCheck(NULL) && pPhyDrive->ResizeNoShrink) + { + Log("Recheck after Shrink volume success"); + Log("After shrink Disksize:%llu Part2Start:%llu", pPhyDrive->SizeInBytes, pPhyDrive->ResizePart2StartSector * 512); + } + else + { + Log("Recheck after Shrink volume failed %u", pPhyDrive->ResizeNoShrink); + goto End; + } + } + else + { + Log("Shrink volume failed"); + goto End; + } + } + + + //Now try write data + hDrive = GetPhysicalHandle(pPhyDrive->PhyDrive, TRUE, TRUE, FALSE); + if (hDrive == INVALID_HANDLE_VALUE) + { + Log("Failed to GetPhysicalHandle for update."); + goto End; + } + + + //Write partition 2 data + PROGRESS_BAR_SET_POS(PT_FORMAT_PART2); + if (0 != FormatPart2Fat(hDrive, pPhyDrive->ResizePart2StartSector)) + { + Log("FormatPart2Fat failed."); + goto End; + } + + //Write grub stage2 gap + PROGRESS_BAR_SET_POS(PT_WRITE_STG1_IMG); + Log("Writing Boot Image ............................. "); + if (WriteGrubStage1ToPhyDrive(hDrive, PartStyle) != 0) + { + Log("WriteGrubStage1ToPhyDrive failed."); + goto End; + } + + + //Write partition table + PROGRESS_BAR_SET_POS(PT_WRITE_PART_TABLE); + Log("Writing partition table ............................. "); + + VentoyGetLocalBootImg(&MBR); + CoCreateGuid(&Guid); + memcpy(MBR.BootCode + 0x180, &Guid, 16); + memcpy(pMBR->BootCode, MBR.BootCode, 440); + + if (PartStyle == 0) + { + for (i = 1; i < 4; i++) + { + if (pMBR->PartTbl[i].SectorCount == 0) + { + break; + } + } + + if (i >= 4) + { + Log("Can not find MBR free partition table"); + goto End; + } + + for (j = i - 1; j > 0; j--) + { + Log("Move MBR partition table %d --> %d", j + 1, j + 2); + memcpy(pMBR->PartTbl + (j + 1), pMBR->PartTbl + j, sizeof(PART_TABLE)); + } + + VentoyFillMBRLocation(pPhyDrive->SizeInBytes, (UINT32)pPhyDrive->ResizePart2StartSector, VENTOY_EFI_PART_SIZE / 512, pMBR->PartTbl + 1); + pMBR->PartTbl[0].Active = 0x80; // bootable + pMBR->PartTbl[1].Active = 0x00; + pMBR->PartTbl[1].FsFlag = 0xEF; // EFI System Partition + + if (!WriteDataToPhyDisk(hDrive, 0, pMBR, 512)) + { + Log("Legacy BIOS write MBR failed"); + goto End; + } + } + else + { + for (i = 1; i < 128; i++) + { + if (memcmp(&(pGPT->PartTbl[i].PartGuid), &ZeroGuid, sizeof(GUID)) == 0) + { + break; + } + } + + if (i >= 128) + { + Log("Can not find GPT free partition table"); + goto End; + } + + for (j = i - 1; j > 0; j--) + { + Log("Move GPT partition table %d --> %d", j + 1, j + 2); + memcpy(pGPT->PartTbl + (j + 1), pGPT->PartTbl + j, sizeof(VTOY_GPT_PART_TBL)); + } + + + pMBR->BootCode[92] = 0x22; + + // to fix windows issue + memcpy(&(pGPT->PartTbl[1].PartType), &WindowsDataPartType, sizeof(GUID)); + CoCreateGuid(&(pGPT->PartTbl[1].PartGuid)); + + pGPT->PartTbl[1].StartLBA = pGPT->PartTbl[0].LastLBA + 1; + pGPT->PartTbl[1].LastLBA = pGPT->PartTbl[1].StartLBA + VENTOY_EFI_PART_SIZE / 512 - 1; + pGPT->PartTbl[1].Attr = 0xC000000000000001ULL; + memcpy(pGPT->PartTbl[1].Name, L"VTOYEFI", 7 * 2); + + //Update CRC + pGPT->Head.PartTblCrc = VentoyCrc32(pGPT->PartTbl, sizeof(pGPT->PartTbl)); + pGPT->Head.Crc = VentoyCrc32(&(pGPT->Head), pGPT->Head.Length); + + Log("pGPT->Head.EfiStartLBA=%llu", (ULONGLONG)pGPT->Head.EfiStartLBA); + Log("pGPT->Head.EfiBackupLBA=%llu", (ULONGLONG)pGPT->Head.EfiBackupLBA); + + VentoyFillBackupGptHead(pGPT, &BackupHead); + if (!WriteDataToPhyDisk(hDrive, pGPT->Head.EfiBackupLBA * 512, &BackupHead, 512)) + { + Log("UEFI write backup head failed"); + goto End; + } + + if (!WriteDataToPhyDisk(hDrive, (pGPT->Head.EfiBackupLBA - 32) * 512, pGPT->PartTbl, 512 * 32)) + { + Log("UEFI write backup partition table failed"); + goto End; + } + + if (!WriteDataToPhyDisk(hDrive, 0, pGPT, 512 * 34)) + { + Log("UEFI write MBR & Main partition table failed"); + goto End; + } + } + + + + //Refresh Drive Layout + DeviceIoControl(hDrive, IOCTL_DISK_UPDATE_PROPERTIES, NULL, 0, NULL, 0, &dwSize, NULL); + + //We must close handle here, because it will block the refresh bellow + CHECK_CLOSE_HANDLE(hDrive); + + Sleep(2000); + + //Refresh disk list + PhyDrive = pPhyDrive->PhyDrive; + + Log("#### Now Refresh PhyDrive ####"); + Ventoy2DiskDestroy(); + Ventoy2DiskInit(); + + pPhyDrive = GetPhyDriveInfoByPhyDrive(PhyDrive); + if (pPhyDrive) + { + if (pPhyDrive->VentoyVersion[0] == 0) + { + Log("After process the Ventoy version is still invalid"); + goto End; + } + + Log("### Ventoy non-destructive installation successfully finished <%s>", pPhyDrive->VentoyVersion); + } + else + { + Log("### Ventoy non-destructive installation successfully finished "); + } + + InitComboxCtrl(g_DialogHwnd, PhyDrive); + + rc = 0; + +End: + CHECK_CLOSE_HANDLE(hDrive); + return rc; +} + + static BOOL DiskCheckWriteAccess(HANDLE hDrive) { DWORD dwSize; diff --git a/Ventoy2Disk/Ventoy2Disk/Utility.c b/Ventoy2Disk/Ventoy2Disk/Utility.c index 1fbe9f44..d2d31887 100644 --- a/Ventoy2Disk/Ventoy2Disk/Utility.c +++ b/Ventoy2Disk/Ventoy2Disk/Utility.c @@ -583,6 +583,7 @@ void DumpWindowsVersion(void) return; } + BOOL IsVentoyLogicalDrive(CHAR DriveLetter) { int i; @@ -666,6 +667,7 @@ int VentoyFillMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR, int PartStyle) Log("Disk signature: 0x%08x", DiskSignature); *((UINT32 *)(pMBR->BootCode + 0x1B8)) = DiskSignature; + memcpy(pMBR->BootCode + 0x180, &Guid, 16); if (DiskSizeBytes / 512 > 0xFFFFFFFF) { @@ -742,6 +744,7 @@ static int VentoyFillProtectMBR(UINT64 DiskSizeBytes, MBR_HEAD *pMBR) Log("Disk signature: 0x%08x", DiskSignature); *((UINT32 *)(pMBR->BootCode + 0x1B8)) = DiskSignature; + memcpy(pMBR->BootCode + 0x180, &Guid, 16); DiskSectorCount = DiskSizeBytes / 512 - 1; if (DiskSectorCount > 0xFFFFFFFF) diff --git a/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c b/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c index 5ba9e71a..2f7d2334 100644 --- a/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c +++ b/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c @@ -110,7 +110,7 @@ static BOOL IsVentoyPhyDrive(int PhyDrive, UINT64 SizeBytes, MBR_HEAD *pMBR, UIN for (i = 0; i < 4; i++) { - Log("=========== Partition Table %d ============", i + 1); + Log("=========== Disk%d Partition Table %d ============", PhyDrive, i + 1); Log("PartTbl.Active = 0x%x", MBR.PartTbl[i].Active); Log("PartTbl.FsFlag = 0x%x", MBR.PartTbl[i].FsFlag); Log("PartTbl.StartSectorId = %u", MBR.PartTbl[i].StartSectorId); @@ -246,7 +246,7 @@ static int FilterPhysicalDrive(PHY_DRIVE_INFO *pDriveList, DWORD DriveCount) if (LogDrive & 0x01) { LogLetter[LetterCount] = Letter; - PhyDriveId[LetterCount] = GetPhyDriveByLogicalDrive(Letter); + PhyDriveId[LetterCount] = GetPhyDriveByLogicalDrive(Letter, NULL); Log("Logical Drive:%C ===> PhyDrive:%d", LogLetter[LetterCount], PhyDriveId[LetterCount]); LetterCount++; @@ -332,6 +332,23 @@ PHY_DRIVE_INFO * GetPhyDriveInfoById(int Id) return NULL; } + +PHY_DRIVE_INFO * GetPhyDriveInfoByPhyDrive(int PhyDrive) +{ + DWORD i; + for (i = 0; i < g_PhyDriveCount; i++) + { + if (g_PhyDriveList[i].PhyDrive == PhyDrive) + { + return g_PhyDriveList + i; + } + } + + return NULL; +} + + + int SortPhysicalDrive(PHY_DRIVE_INFO *pDriveList, DWORD DriveCount) { DWORD i, j; @@ -398,5 +415,8 @@ int Ventoy2DiskInit(void) int Ventoy2DiskDestroy(void) { free(g_PhyDriveList); + g_PhyDriveList = NULL; + g_PhyDriveCount = 0; + return 0; } diff --git a/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.h b/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.h index 8b77ea1e..fedcd0ba 100644 --- a/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.h +++ b/Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.h @@ -23,6 +23,7 @@ #include +#define SIZE_1GB (1024 * 1024 * 1024) #define SIZE_1MB (1024 * 1024) #define SIZE_2MB (2048 * 1024) #define VENTOY_EFI_PART_SIZE (32 * SIZE_1MB) @@ -43,6 +44,15 @@ #define safe_sprintf(dst, fmt, ...) sprintf_s(dst, sizeof(dst), fmt, __VA_ARGS__) #define safe_strcpy(dst, src) strcpy_s(dst, sizeof(dst), src) +#define CHECK_FREE(p) \ +{\ + if (p)\ + {\ + free(p); \ + (p) = NULL; \ + }\ +} + #define CHECK_CLOSE_HANDLE(Handle) \ {\ if (Handle != INVALID_HANDLE_VALUE) \ @@ -155,6 +165,13 @@ typedef struct PHY_DRIVE_INFO BOOL SecureBootSupport; MBR_HEAD MBR; UINT64 Part2GPTAttr; + + BOOL ResizeNoShrink; + CHAR ResizeVolumeGuid[64]; + CHAR FsName[64]; + UINT64 ResizePart2StartSector; + VTOY_GPT_INFO Gpt; + }PHY_DRIVE_INFO; typedef enum PROGRESS_POINT @@ -206,13 +223,15 @@ BOOL IsVentoyLogicalDrive(CHAR DriveLetter); int GetRegDwordValue(HKEY Key, LPCSTR SubKey, LPCSTR ValueName, DWORD *pValue); int GetPhysicalDriveCount(void); int GetAllPhysicalDriveInfo(PHY_DRIVE_INFO *pDriveList, DWORD *pDriveCount); -int GetPhyDriveByLogicalDrive(int DriveLetter); +int GetPhyDriveByLogicalDrive(int DriveLetter, UINT64*Offset); int GetVentoyVerInPhyDrive(const PHY_DRIVE_INFO *pDriveInfo, UINT64 Part2StartSector, CHAR *VerBuf, size_t BufLen, BOOL *pSecureBoot); int Ventoy2DiskInit(void); int Ventoy2DiskDestroy(void); PHY_DRIVE_INFO * GetPhyDriveInfoById(int Id); +PHY_DRIVE_INFO * GetPhyDriveInfoByPhyDrive(int PhyDrive); int ParseCmdLineOption(LPSTR lpCmdLine); int InstallVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int PartStyle, int TryId); +int PartitionResizeForVentoy(PHY_DRIVE_INFO *pPhyDrive); int UpdateVentoy2PhyDrive(PHY_DRIVE_INFO *pPhyDrive, int TryId); int VentoyFillBackupGptHead(VTOY_GPT_INFO *pInfo, VTOY_GPT_HDR *pHead); int VentoyFillWholeGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo); @@ -232,6 +251,7 @@ int FindProcessOccupyDisk(HANDLE hDrive, PHY_DRIVE_INFO *pPhyDrive); int VentoyFillMBRLocation(UINT64 DiskSizeInBytes, UINT32 StartSectorId, UINT32 SectorCount, PART_TABLE *Table); int ClearVentoyFromPhyDrive(HWND hWnd, PHY_DRIVE_INFO *pPhyDrive, char *pDrvLetter); UINT32 VentoyCrc32(void *Buffer, UINT32 Length); +BOOL PartResizePreCheck(PHY_DRIVE_INFO** ppPhyDrive); #define SET_FILE_POS(pos) \ liCurrentPosition.QuadPart = pos; \ @@ -290,12 +310,15 @@ typedef struct { #pragma pack() extern int __static_assert__[sizeof(VTSI_FOOTER) == 512 ? 1 : -1]; +extern HWND g_DialogHwnd; #define SAFE_FREE(ptr) if (ptr) { free(ptr); (ptr) = NULL; } int InstallVentoy2FileImage(PHY_DRIVE_INFO *pPhyDrive, int PartStyle); void disk_io_set_imghook(FILE *fp, VTSI_SEGMENT *segment, int maxseg, UINT64 data_offset); void disk_io_reset_imghook(int *psegnum, UINT64 *pDataOffset); +HANDLE GetPhysicalHandle(int Drive, BOOLEAN bLockDrive, BOOLEAN bWriteAccess, BOOLEAN bWriteShare); +void InitComboxCtrl(HWND hWnd, int PhyDrive); #define VTSI_SUPPORT 1 diff --git a/Ventoy2Disk/Ventoy2Disk/WinDialog.c b/Ventoy2Disk/Ventoy2Disk/WinDialog.c index 63cf2fee..9cebd76c 100644 Binary files a/Ventoy2Disk/Ventoy2Disk/WinDialog.c and b/Ventoy2Disk/Ventoy2Disk/WinDialog.c differ