mirror of
https://github.com/ventoy/Ventoy.git
synced 2025-12-22 03:26:17 +00:00
update
This commit is contained in:
@@ -52,6 +52,8 @@ static grub_env_get_pf grub_env_get = NULL;
|
||||
ventoy_grub_param_file_replace *g_file_replace_list = NULL;
|
||||
ventoy_efi_file_replace g_efi_file_replace;
|
||||
|
||||
BOOLEAN g_fix_windows_1st_cdrom_issue = FALSE;
|
||||
|
||||
STATIC BOOLEAN g_hook_keyboard = FALSE;
|
||||
|
||||
CHAR16 gFirstTryBootFile[256] = {0};
|
||||
@@ -493,6 +495,7 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
|
||||
EFI_STATUS Status = EFI_SUCCESS;
|
||||
ventoy_grub_param *pGrubParam = NULL;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *pImageInfo = NULL;
|
||||
ventoy_chain_head *chain = NULL;
|
||||
|
||||
Status = gBS->HandleProtocol(ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&pImageInfo);
|
||||
if (EFI_ERROR(Status))
|
||||
@@ -559,12 +562,15 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
|
||||
);
|
||||
|
||||
pPos = StrStr(pCmdLine, L"mem:");
|
||||
g_chain = (ventoy_chain_head *)StrHexToUintn(pPos + 4);
|
||||
chain = (ventoy_chain_head *)StrHexToUintn(pPos + 4);
|
||||
|
||||
pPos = StrStr(pPos, L"size:");
|
||||
size = StrDecimalToUintn(pPos + 5);
|
||||
|
||||
debug("memory addr:%p size:%lu", g_chain, size);
|
||||
debug("memory addr:%p size:%lu", chain, size);
|
||||
|
||||
g_chain = AllocatePool(size);
|
||||
CopyMem(g_chain, chain, size);
|
||||
|
||||
if (StrStr(pCmdLine, L"memdisk"))
|
||||
{
|
||||
@@ -583,12 +589,12 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
|
||||
g_os_param_reserved = (UINT8 *)(g_chain->os_param.vtoy_reserved);
|
||||
|
||||
/* Workaround for Windows & ISO9660 */
|
||||
if (g_os_param_reserved[2] == 1 && g_os_param_reserved[3] == 0)
|
||||
if (g_os_param_reserved[2] == ventoy_chain_windows && g_os_param_reserved[3] == 0)
|
||||
{
|
||||
g_fixup_iso9660_secover_enable = TRUE;
|
||||
}
|
||||
|
||||
if (g_os_param_reserved[2] == 1 && g_os_param_reserved[4] != 1)
|
||||
if (g_os_param_reserved[2] == ventoy_chain_windows && g_os_param_reserved[4] != 1)
|
||||
{
|
||||
g_hook_keyboard = TRUE;
|
||||
}
|
||||
@@ -613,6 +619,17 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
|
||||
}
|
||||
}
|
||||
|
||||
g_fix_windows_1st_cdrom_issue = FALSE;
|
||||
if (ventoy_chain_windows == g_os_param_reserved[2] ||
|
||||
ventoy_chain_wim == g_os_param_reserved[2])
|
||||
{
|
||||
if (ventoy_is_cdrom_dp_exist())
|
||||
{
|
||||
debug("fixup the 1st cdrom influences when boot windows ...");
|
||||
g_fix_windows_1st_cdrom_issue = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
FreePool(pCmdLine);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -636,6 +653,44 @@ EFI_STATUS EFIAPI ventoy_clean_env(VOID)
|
||||
FreePool((VOID *)(UINTN)g_chain->os_param.vtoy_img_location_addr);
|
||||
}
|
||||
|
||||
FreePool(g_chain);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC EFI_STATUS ventoy_hook_start(VOID)
|
||||
{
|
||||
/* don't add debug print in this function */
|
||||
|
||||
if (g_fix_windows_1st_cdrom_issue)
|
||||
{
|
||||
ventoy_hook_1st_cdrom_start();
|
||||
}
|
||||
|
||||
/* let this the last */
|
||||
if (g_hook_keyboard)
|
||||
{
|
||||
ventoy_hook_keyboard_start();
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
STATIC EFI_STATUS ventoy_hook_stop(VOID)
|
||||
{
|
||||
/* don't add debug print in this function */
|
||||
|
||||
if (g_fix_windows_1st_cdrom_issue)
|
||||
{
|
||||
ventoy_hook_1st_cdrom_stop();
|
||||
}
|
||||
|
||||
/* let this the last */
|
||||
if (g_hook_keyboard)
|
||||
{
|
||||
ventoy_hook_keyboard_stop();
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -725,17 +780,11 @@ EFI_STATUS EFIAPI ventoy_boot(IN EFI_HANDLE ImageHandle)
|
||||
pFile->OpenVolume = ventoy_wrapper_open_volume;
|
||||
}
|
||||
|
||||
if (g_hook_keyboard)
|
||||
{
|
||||
ventoy_hook_keyboard_start();
|
||||
}
|
||||
ventoy_hook_start();
|
||||
/* can't add debug print here */
|
||||
//ventoy_wrapper_system();
|
||||
Status = gBS->StartImage(Image, NULL, NULL);
|
||||
if (g_hook_keyboard)
|
||||
{
|
||||
ventoy_hook_keyboard_stop();
|
||||
}
|
||||
ventoy_hook_stop();
|
||||
|
||||
if (EFI_ERROR(Status))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user