mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-08-28 00:11:15 +00:00
bug fix
This commit is contained in:
@@ -38,9 +38,9 @@ const TCHAR * g_Str_English[STR_ID_MAX] =
|
||||
TEXT("The disk will be formatted and all the data will be lost.\r\nContinue?"),
|
||||
TEXT("The disk will be formatted and all the data will be lost.\r\nContinue? (Double Check)"),
|
||||
TEXT("Congratulations!\r\nVentoy has been successfully installed to the device."),
|
||||
TEXT("An error occurred during the installation. You can try again and check log.txt for detail."),
|
||||
TEXT("An error occurred during the installation. You can replug the USB and try again. Check log.txt for detail."),
|
||||
TEXT("Congratulations!\r\nVentoy has been successfully updated to the device."),
|
||||
TEXT("An error occurred during the update. You can try again and check log.txt for detail."),
|
||||
TEXT("An error occurred during the update. You can replug the USB and try again. Check log.txt for detail."),
|
||||
|
||||
TEXT("A thread is running, please wait..."),
|
||||
};
|
||||
@@ -61,9 +61,9 @@ const TCHAR * g_Str_ChineseSimple[STR_ID_MAX] =
|
||||
TEXT("<EFBFBD><EFBFBD><EFBFBD>̻ᱻ<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6>ᶪʧ!\r\n<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),
|
||||
TEXT("<EFBFBD><EFBFBD><EFBFBD>̻ᱻ<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6>ᶪʧ!\r\n<EFBFBD>ٴ<EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"),
|
||||
TEXT("<EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD>! Ventoy <20>Ѿ<EFBFBD><D1BE>ɹ<EFBFBD><C9B9><EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>."),
|
||||
TEXT("<EFBFBD><EFBFBD>װ Ventoy <20><><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>, <20><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> log.txt <20>ļ<EFBFBD>."),
|
||||
TEXT("<EFBFBD><EFBFBD>װ Ventoy <20><><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>°β<EFBFBD>һ<EFBFBD><EFBFBD>U<EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>, <20><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> log.txt <20>ļ<EFBFBD>."),
|
||||
TEXT("<EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD>! <20>°汾<C2B0><E6B1BE> Ventoy <20>Ѿ<EFBFBD><D1BE>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>."),
|
||||
TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ventoy <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>, <20><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> log.txt <20>ļ<EFBFBD>."),
|
||||
TEXT("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ventoy <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>°β<EFBFBD>һ<EFBFBD><EFBFBD>U<EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>, <20><>ϸ<EFBFBD><CFB8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> log.txt <20>ļ<EFBFBD>."),
|
||||
|
||||
TEXT("<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ȴ<EFBFBD>..."),
|
||||
};
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
PHY_DRIVE_INFO *g_PhyDriveList = NULL;
|
||||
DWORD g_PhyDriveCount = 0;
|
||||
static int g_FilterRemovable = 1;
|
||||
static int g_FilterRemovable = 0;
|
||||
static int g_FilterUSB = 1;
|
||||
int g_ForceOperation = 1;
|
||||
|
||||
@@ -41,11 +41,8 @@ int ParseCmdLineOption(LPSTR lpCmdLine)
|
||||
|
||||
for (i = 0; i < __argc; i++)
|
||||
{
|
||||
if (strncmp(__argv[i], "-R", 2) == 0)
|
||||
{
|
||||
g_FilterRemovable = 0;
|
||||
}
|
||||
else if (strncmp(__argv[i], "-U", 2) == 0)
|
||||
if (strncmp(__argv[i], "-U", 2) == 0 ||
|
||||
strncmp(__argv[i], "-u", 2) == 0)
|
||||
{
|
||||
g_FilterUSB = 0;
|
||||
}
|
||||
@@ -58,11 +55,6 @@ int ParseCmdLineOption(LPSTR lpCmdLine)
|
||||
GetCurrentDirectoryA(sizeof(cfgfile), cfgfile);
|
||||
strcat_s(cfgfile, sizeof(cfgfile), "\\Ventoy2Disk.ini");
|
||||
|
||||
if (0 == GetPrivateProfileIntA("Filter", "Removable", 1, cfgfile))
|
||||
{
|
||||
g_FilterRemovable = 0;
|
||||
}
|
||||
|
||||
if (0 == GetPrivateProfileIntA("Filter", "USB", 1, cfgfile))
|
||||
{
|
||||
g_FilterUSB = 0;
|
||||
@@ -258,6 +250,30 @@ PHY_DRIVE_INFO * GetPhyDriveInfoById(int Id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int SortPhysicalDrive(PHY_DRIVE_INFO *pDriveList, DWORD DriveCount)
|
||||
{
|
||||
DWORD i, j;
|
||||
PHY_DRIVE_INFO TmpDriveInfo;
|
||||
|
||||
for (i = 0; i < DriveCount; i++)
|
||||
{
|
||||
for (j = i + 1; j < DriveCount; j++)
|
||||
{
|
||||
if (pDriveList[i].BusType == BusTypeUsb && pDriveList[j].BusType == BusTypeUsb)
|
||||
{
|
||||
if (pDriveList[i].RemovableMedia == FALSE && pDriveList[j].RemovableMedia == TRUE)
|
||||
{
|
||||
memcpy(&TmpDriveInfo, pDriveList + i, sizeof(PHY_DRIVE_INFO));
|
||||
memcpy(pDriveList + i, pDriveList + j, sizeof(PHY_DRIVE_INFO));
|
||||
memcpy(pDriveList + j, &TmpDriveInfo, sizeof(PHY_DRIVE_INFO));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Ventoy2DiskInit(void)
|
||||
{
|
||||
g_PhyDriveList = (PHY_DRIVE_INFO *)malloc(sizeof(PHY_DRIVE_INFO)* VENTOY_MAX_PHY_DRIVE);
|
||||
@@ -269,6 +285,9 @@ int Ventoy2DiskInit(void)
|
||||
memset(g_PhyDriveList, 0, sizeof(PHY_DRIVE_INFO)* VENTOY_MAX_PHY_DRIVE);
|
||||
|
||||
GetAllPhysicalDriveInfo(g_PhyDriveList, &g_PhyDriveCount);
|
||||
|
||||
SortPhysicalDrive(g_PhyDriveList, g_PhyDriveCount);
|
||||
|
||||
FilterPhysicalDrive(g_PhyDriveList, g_PhyDriveCount);
|
||||
|
||||
return 0;
|
||||
|
Binary file not shown.
@@ -213,6 +213,16 @@ static DWORD WINAPI InstallVentoyThread(void* Param)
|
||||
PHY_DRIVE_INFO *pPhyDrive = (PHY_DRIVE_INFO *)Param;
|
||||
|
||||
rc = InstallVentoy2PhyDrive(pPhyDrive);
|
||||
if (rc)
|
||||
{
|
||||
Log("This time install failed, now wait and retry...");
|
||||
Sleep(10000);
|
||||
|
||||
Log("Now retry to install...");
|
||||
|
||||
rc = InstallVentoy2PhyDrive(pPhyDrive);
|
||||
}
|
||||
|
||||
if (rc == 0)
|
||||
{
|
||||
PROGRESS_BAR_SET_POS(PT_FINISH);
|
||||
@@ -239,6 +249,16 @@ static DWORD WINAPI UpdateVentoyThread(void* Param)
|
||||
PHY_DRIVE_INFO *pPhyDrive = (PHY_DRIVE_INFO *)Param;
|
||||
|
||||
rc = UpdateVentoy2PhyDrive(pPhyDrive);
|
||||
if (rc)
|
||||
{
|
||||
Log("This time update failed, now wait and retry...");
|
||||
Sleep(10000);
|
||||
|
||||
Log("Now retry to update...");
|
||||
|
||||
rc = UpdateVentoy2PhyDrive(pPhyDrive);
|
||||
}
|
||||
|
||||
if (rc == 0)
|
||||
{
|
||||
PROGRESS_BAR_SET_POS(PT_FINISH);
|
||||
|
Reference in New Issue
Block a user