30 SHELL_FILE_HANDLE InFileHandle;
31 SHELL_FILE_HANDLE OutFileHandle;
38 CONST CHAR16 *OutFileName;
43 CONST CHAR16 *TempParam;
71 if (EFI_ERROR (Status)) {
72 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
88 if (TempParam ==
NULL) {
89 ASSERT (TempParam !=
NULL);
97 if ((InFileName ==
NULL) || (OutFileName ==
NULL)) {
113 if (EFI_ERROR (Status)) {
121 if (EFI_ERROR (Status)) {
133 if (EFI_ERROR (Status)) {
140 if (InBuffer ==
NULL) {
141 Status = EFI_OUT_OF_RESOURCES;
143 Status = gEfiShellProtocol->ReadFile (InFileHandle, &InSize, InBuffer);
146 Status =
gBS->LocateProtocol (&gEfiDecompressProtocolGuid,
NULL, (VOID **)&
Decompress);
152 if (EFI_ERROR (Status) || (OutSize == 0)) {
156 Status =
ShellOpenFileByName (OutFileName, &OutFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
157 if (EFI_ERROR (Status)) {
163 if ((OutBuffer ==
NULL) || (ScratchBuffer ==
NULL)) {
164 Status = EFI_OUT_OF_RESOURCES;
166 Status =
Decompress->Decompress (
Decompress, InBuffer, (UINT32)InSize, OutBuffer, OutSize, ScratchBuffer, ScratchSize);
171 if (EFI_ERROR (Status)) {
175 OutSizeTemp = OutSize;
176 Status = gEfiShellProtocol->WriteFile (OutFileHandle, &OutSizeTemp, OutBuffer);
177 OutSize = (UINT32)OutSizeTemp;
178 if (EFI_ERROR (Status)) {
192 if (InFileHandle !=
NULL) {
193 gEfiShellProtocol->CloseFile (InFileHandle);
196 if (OutFileHandle !=
NULL) {
197 gEfiShellProtocol->CloseFile (OutFileHandle);
200 SHELL_FREE_NON_NULL (InFileName);
201 SHELL_FREE_NON_NULL (InBuffer);
202 SHELL_FREE_NON_NULL (OutBuffer);
203 SHELL_FREE_NON_NULL (ScratchBuffer);
205 return (ShellStatus);
SHELL_STATUS EFIAPI ShellCommandRunEfiDecompress(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI FileHandleGetSize(IN EFI_FILE_HANDLE FileHandle, OUT UINT64 *Size)
EFI_STATUS EFIAPI Decompress(IN CONST EFI_PEI_DECOMPRESS_PPI *This, IN CONST EFI_COMPRESSION_SECTION *CompressionSection, OUT VOID **OutputBuffer, OUT UINTN *OutputSize)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
RETURN_STATUS EFIAPI SafeUint64ToUint32(IN UINT64 Operand, OUT UINT32 *Result)
EFI_STATUS EFIAPI CommandInit(VOID)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
EFI_STATUS EFIAPI ShellOpenFileByName(IN CONST CHAR16 *FileName, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
EFI_STATUS EFIAPI ShellIsDirectory(IN CONST CHAR16 *DirName)
CHAR16 *EFIAPI ShellFindFilePath(IN CONST CHAR16 *FileName)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
UINTN EFIAPI ShellCommandLineGetCount(IN CONST LIST_ENTRY *CheckPackage)
SHELL_PARAM_ITEM EmptyParamList[]
Helper structure for no parameters (besides -? and -b)