X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/Ventoy.git/blobdiff_plain/aa0a2ed06726687595caf35a37946734422eb937..a6d3ecc7a9b01e6cd7a08bb03ca72a88f928df8d:/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c diff --git a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c index ed595b9..004c83f 100644 --- a/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c +++ b/EDK2/edk2_mod/edk2-edk2-stable201911/MdeModulePkg/Application/Ventoy/VentoyProtocol.c @@ -699,8 +699,16 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_set_pos(EFI_FILE_HANDLE This, UINT64 Position) { (VOID)This; + + if (Position <= g_efi_file_replace.FileSizeBytes) + { + g_efi_file_replace.CurPos = Position; + } + else + { + g_efi_file_replace.CurPos = g_efi_file_replace.FileSizeBytes; + } - g_efi_file_replace.CurPos = Position; return EFI_SUCCESS; } @@ -815,6 +823,8 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open CHAR8 TmpName[256]; ventoy_virt_chunk *virt = NULL; + debug("## ventoy_wrapper_file_open <%s> ", Name); + Status = g_original_fopen(This, New, Name, Mode, Attributes); if (EFI_ERROR(Status)) { @@ -850,6 +860,11 @@ STATIC EFI_STATUS EFIAPI ventoy_wrapper_file_open return Status; } } + + if (StrCmp(Name, L"\\EFI\\BOOT") == 0) + { + (*New)->Open = ventoy_wrapper_file_open; + } } return Status;