30 SHELL_FILE_HANDLE InShellFileHandle;
31 SHELL_FILE_HANDLE OutShellFileHandle;
39 CONST CHAR16 *OutFileName;
40 CONST CHAR16 *TempParam;
48 InShellFileHandle =
NULL;
49 OutShellFileHandle =
NULL;
66 if (EFI_ERROR (Status)) {
67 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
83 if (TempParam ==
NULL) {
84 ASSERT (TempParam !=
NULL);
92 if ((InFileName ==
NULL) || (OutFileName ==
NULL)) {
108 if (EFI_ERROR (Status)) {
113 Status =
ShellOpenFileByName (OutFileName, &OutShellFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);
114 if (EFI_ERROR (Status)) {
121 Status = gEfiShellProtocol->GetFileSize (InShellFileHandle, &InSize);
124 if (InBuffer ==
NULL) {
125 Status = EFI_OUT_OF_RESOURCES;
127 InSize2 = (
UINTN)InSize;
128 Status = gEfiShellProtocol->ReadFile (InShellFileHandle, &InSize2, InBuffer);
131 Status =
Compress (InBuffer, InSize, OutBuffer, &OutSize);
132 if (Status == EFI_BUFFER_TOO_SMALL) {
134 if (OutBuffer ==
NULL) {
135 Status = EFI_OUT_OF_RESOURCES;
137 Status =
Compress (InBuffer, InSize, OutBuffer, &OutSize);
142 if (EFI_ERROR (Status)) {
146 OutSize2 = (
UINTN)OutSize;
147 Status = gEfiShellProtocol->WriteFile (OutShellFileHandle, &OutSize2, OutBuffer);
148 if (EFI_ERROR (Status)) {
165 if (InShellFileHandle !=
NULL) {
166 gEfiShellProtocol->CloseFile (InShellFileHandle);
169 if (OutShellFileHandle !=
NULL) {
170 gEfiShellProtocol->CloseFile (OutShellFileHandle);
173 SHELL_FREE_NON_NULL (InFileName);
174 SHELL_FREE_NON_NULL (InBuffer);
175 SHELL_FREE_NON_NULL (OutBuffer);
177 return (ShellStatus);
EFI_STATUS Compress(IN VOID *SrcBuffer, IN UINT64 SrcSize, IN VOID *DstBuffer, IN OUT UINT64 *DstSize)
SHELL_STATUS EFIAPI ShellCommandRunEfiCompress(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
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)
VOID EFIAPI Exit(IN EFI_STATUS Status)