Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed Apr 8, 2020
1 parent ef80baf commit c72f963
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 20 deletions.
4 changes: 2 additions & 2 deletions IMG/cpio/sbin/init
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ $BUSYBOX_PATH/busybox --install $BUSYBOX_PATH

export PATH=$BUSYBOX_PATH/:$VTOY_PATH/tool

export VTOY_BREAK_LEVEL=$(hexdump -n 1 -s 429 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
export VTOY_DEBUG_LEVEL=$(hexdump -n 1 -s 430 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
export VTOY_BREAK_LEVEL=$(hexdump -n 1 -s 449 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)
export VTOY_DEBUG_LEVEL=$(hexdump -n 1 -s 450 -e '1/1 "%02x"' $VTOY_PATH/ventoy_os_param)

#Fixme: busybox shell output redirect seems to have some bug in rhel5
if uname -a | grep -q el5; then
Expand Down
6 changes: 6 additions & 0 deletions IMG/mkcpio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

VENTOY_PATH=$PWD/../

if [ -e check.sh ]; then
if ! sh check.sh; then
exit 1
fi
fi

rm -f ventoy.cpio

chmod -R 777 cpio
Expand Down
Binary file modified INSTALL/Ventoy2Disk.exe
Binary file not shown.
10 changes: 7 additions & 3 deletions INSTALL/grub/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,12 @@ function uefi_iso_menu_func {
loopback -d loop
fi

unset LoadIsoEfiDriver

if [ -n "$vtisouefi" ]; then
set LoadIsoEfiDriver=on
else
unset LoadIsoEfiDriver
fi

vt_chosen_img_path chosen_path

if vt_is_udf ${1}${chosen_path}; then
Expand Down Expand Up @@ -302,7 +306,7 @@ function legacy_iso_menu_func {
#############################################################
#############################################################

set VENTOY_VERSION="1.0.01"
set VENTOY_VERSION="1.0.02"

#disable timeout
unset timeout
Expand Down
Binary file modified INSTALL/ventoy/ipxe.krn
Binary file not shown.
Binary file modified INSTALL/ventoy/ventoy.cpio
Binary file not shown.
5 changes: 5 additions & 0 deletions IPXE/ipxe-3fe683e/src/arch/x86/core/ventoy_vdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,16 @@ static void ventoy_dump_chain(ventoy_chain_head *chain)
uint32_t i = 0;
uint8_t chksum = 0;
uint8_t *guid;
uint8_t *vtoy_reserve;

guid = chain->os_param.vtoy_disk_guid;
for (i = 0; i < sizeof(ventoy_os_param); i++)
{
chksum += *((uint8_t *)(&(chain->os_param)) + i);
}

vtoy_reserve = (uint8_t *)(chain->os_param.vtoy_reserved);

printf("##################### ventoy_dump_chain #######################\n");

printf("os_param will be save at %p\n", ventoy_get_runtime_addr());
Expand All @@ -379,6 +382,8 @@ static void ventoy_dump_chain(ventoy_chain_head *chain)
printf("os_param->vtoy_disk_part_type=%u\n", chain->os_param.vtoy_disk_part_type);
printf("os_param->vtoy_img_path=<%s>\n", chain->os_param.vtoy_img_path);
printf("os_param->vtoy_img_size=<%llu>\n", chain->os_param.vtoy_img_size);
printf("os_param->vtoy_reserve[0]=<%u>\n", vtoy_reserve[0]);
printf("os_param->vtoy_reserve[1]=<%u>\n", vtoy_reserve[1]);
printf("os_param->vtoy_img_location_addr=<0x%llx>\n", chain->os_param.vtoy_img_location_addr);
printf("os_param->vtoy_img_location_len=<%u>\n", chain->os_param.vtoy_img_location_len);
ventoy_debug_pause();
Expand Down
8 changes: 4 additions & 4 deletions Ventoy2Disk/Ventoy2Disk/Language.c
Original file line number Diff line number Diff line change
Expand Up @@ -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..."),
};
Expand All @@ -61,9 +61,9 @@ const TCHAR * g_Str_ChineseSimple[STR_ID_MAX] =
TEXT("磁盘会被格式化, 所有数据都会丢失!\r\n是否继续?"),
TEXT("磁盘会被格式化, 所有数据都会丢失!\r\n再次确认是否继续?"),
TEXT("恭喜你! Ventoy 已经成功安装到此设备中."),
TEXT("安装 Ventoy 过程中发生错误. 你可以重试一次, 详细信息请查阅 log.txt 文件."),
TEXT("安装 Ventoy 过程中发生错误. 你可以重新拔插一下U盘然后重试一次, 详细信息请查阅 log.txt 文件."),
TEXT("恭喜你! 新版本的 Ventoy 已经成功更新到此设备中."),
TEXT("更新 Ventoy 过程中遇到错误. 你可以重试一次, 详细信息请查阅 log.txt 文件."),
TEXT("更新 Ventoy 过程中遇到错误. 你可以重新拔插一下U盘然后重试一次, 详细信息请查阅 log.txt 文件."),

TEXT("当前有任务正在运行, 请等待..."),
};
Expand Down
41 changes: 30 additions & 11 deletions Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down
Binary file modified Ventoy2Disk/Ventoy2Disk/Ventoy2Disk.rc
Binary file not shown.
20 changes: 20 additions & 0 deletions Ventoy2Disk/Ventoy2Disk/WinDialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit c72f963

Please sign in to comment.