Clean up Library LzmaCustomDecompressLib, PeiRecoveryLib and driver SectionExtraction

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8658 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4
2009-06-25 08:40:49 +00:00
parent 24a2dd3d08
commit 182b1d1623
10 changed files with 1298 additions and 1502 deletions

View File

@@ -1,7 +1,9 @@
/** @file
LZMA Decompress GUIDed Section Extraction Library
LZMA Decompress GUIDed Section Extraction Library.
It wraps Lzma decompress interfaces to GUIDed Section Extraction interfaces
and registers them into GUIDed handler table.
Copyright (c) 2006 - 2009, Intel Corporation<BR>
Copyright (c) 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -12,66 +14,39 @@
**/
#include <Uefi.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/ExtractGuidedSectionLib.h>
#include <Pi/PiFirmwareFile.h>
#include <Guid/LzmaDecompress.h>
#include "LzmaDecompress.h"
STATIC
RETURN_STATUS
EFIAPI
LzmaGuidedSectionGetCompressedLocation (
IN CONST VOID *InputSection,
OUT VOID **LmzaCompressedData,
OUT UINT32 *LmzaCompressedDataSize OPTIONAL
)
{
if (!CompareGuid (
&gLzmaCustomDecompressGuid,
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
return RETURN_INVALID_PARAMETER;
}
//
// Retrieve the size and attribute of the input section data.
//
*LmzaCompressedData =
(VOID*) (
(UINT8 *) InputSection +
((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset
);
if (LmzaCompressedDataSize != NULL) {
*LmzaCompressedDataSize =
(UINT32)(
(
(*(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size)) &
0x00ffffff
) -
((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset
);
}
return RETURN_SUCCESS;
}
#include "LzmaDecompressLibInternal.h"
/**
The implementation of 'GetInfo' for Guided Section
Extraction of LZMA compression.
Examines a GUIDed section and returns the size of the decoded buffer and the
size of an scratch buffer required to actually decode the data in a GUIDed section.
@param InputSection Buffer containing the input GUIDed section to be processed.
@param OutputBufferSize The size of OutputBuffer.
@param ScratchBufferSize The size of ScratchBuffer.
@param SectionAttribute The attribute of the input guided section.
Examines a GUIDed section specified by InputSection.
If GUID for InputSection does not match the GUID that this handler supports,
then RETURN_UNSUPPORTED is returned.
If the required information can not be retrieved from InputSection,
then RETURN_INVALID_PARAMETER is returned.
If the GUID of InputSection does match the GUID that this handler supports,
then the size required to hold the decoded buffer is returned in OututBufferSize,
the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field
from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute.
If InputSection is NULL, then ASSERT().
If OutputBufferSize is NULL, then ASSERT().
If ScratchBufferSize is NULL, then ASSERT().
If SectionAttribute is NULL, then ASSERT().
@retval RETURN_SUCCESS The size of destination buffer and the size of scratch buffer are successull retrieved.
@retval RETURN_INVALID_PARAMETER The source data is corrupted, or
The GUID in InputSection does not match this instance guid.
@param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.
@param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required
if the buffer specified by InputSection were decoded.
@param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space
if the buffer specified by InputSection were decoded.
@param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes
field of EFI_GUID_DEFINED_SECTION in the PI Specification.
@retval RETURN_SUCCESS The information about InputSection was returned.
@retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.
@retval RETURN_INVALID_PARAMETER The information can not be retrieved from the section specified by InputSection.
**/
RETURN_STATUS
@@ -83,44 +58,58 @@ LzmaGuidedSectionGetInfo (
OUT UINT16 *SectionAttribute
)
{
RETURN_STATUS Status;
VOID *LzmaInput;
UINT32 LzmaInputSize;
ASSERT (InputSection != NULL);
ASSERT (OutputBufferSize != NULL);
ASSERT (ScratchBufferSize != NULL);
ASSERT (SectionAttribute != NULL);
Status = LzmaGuidedSectionGetCompressedLocation(
InputSection,
&LzmaInput,
&LzmaInputSize
);
if (RETURN_ERROR (Status)) {
return Status;
if (!CompareGuid (
&gLzmaCustomDecompressGuid,
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
return RETURN_INVALID_PARAMETER;
}
*SectionAttribute = ((EFI_GUID_DEFINED_SECTION *) InputSection)->Attributes;
return LzmaUefiDecompressGetInfo (
LzmaInput,
LzmaInputSize,
OutputBufferSize,
ScratchBufferSize
);
(UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
(*(UINT32 *) (((EFI_COMMON_SECTION_HEADER *) InputSection)->Size) & 0x00ffffff) - ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
OutputBufferSize,
ScratchBufferSize
);
}
/**
The implementation of Guided Section Extraction
for LZMA compression.
Decompress a LZAM compressed GUIDed section into a caller allocated output buffer.
Decodes the GUIDed section specified by InputSection.
If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned.
If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned.
If the GUID of InputSection does match the GUID that this handler supports, then InputSection
is decoded into the buffer specified by OutputBuffer and the authentication status of this
decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the
data in InputSection, then OutputBuffer is set to point at the data in InputSection. Otherwise,
the decoded data will be placed in caller allocated buffer specified by OutputBuffer.
If InputSection is NULL, then ASSERT().
If OutputBuffer is NULL, then ASSERT().
If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().
If AuthenticationStatus is NULL, then ASSERT().
@param InputSection Buffer containing the input GUIDed section to be processed.
@param OutputBuffer OutputBuffer to point to the start of the section's contents.
if guided data is not prcessed. Otherwise,
OutputBuffer to contain the output data, which is allocated by the caller.
@param ScratchBuffer A pointer to a caller-allocated buffer for function internal use.
@param AuthenticationStatus A pointer to a caller-allocated UINT32 that indicates the
authentication status of the output buffer.
@retval RETURN_SUCCESS Decompression is successfull
@retval RETURN_INVALID_PARAMETER The source data is corrupted, or
The GUID in InputSection does not match this instance guid.
@param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.
@param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation.
@param[out] ScratchBuffer A caller allocated buffer that may be required by this function
as a scratch buffer to perform the decode operation.
@param[out] AuthenticationStatus
A pointer to the authentication status of the decoded output buffer.
See the definition of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI
section of the PI Specification. EFI_AUTH_STATUS_PLATFORM_OVERRIDE must
never be set by this handler.
@retval RETURN_SUCCESS The buffer specified by InputSection was decoded.
@retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.
@retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded.
**/
RETURN_STATUS
@@ -128,20 +117,17 @@ EFIAPI
LzmaGuidedSectionExtraction (
IN CONST VOID *InputSection,
OUT VOID **OutputBuffer,
IN VOID *ScratchBuffer, OPTIONAL
OUT VOID *ScratchBuffer, OPTIONAL
OUT UINT32 *AuthenticationStatus
)
{
RETURN_STATUS Status;
VOID *LzmaInput;
ASSERT (OutputBuffer != NULL);
ASSERT (InputSection != NULL);
Status = LzmaGuidedSectionGetCompressedLocation(
InputSection,
&LzmaInput,
NULL
);
if (RETURN_ERROR (Status)) {
return Status;
if (!CompareGuid (
&gLzmaCustomDecompressGuid,
&(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {
return RETURN_INVALID_PARAMETER;
}
//
@@ -150,7 +136,7 @@ LzmaGuidedSectionExtraction (
*AuthenticationStatus = 0;
return LzmaUefiDecompress (
LzmaInput,
(UINT8 *) InputSection + ((EFI_GUID_DEFINED_SECTION *) InputSection)->DataOffset,
*OutputBuffer,
ScratchBuffer
);
@@ -158,7 +144,7 @@ LzmaGuidedSectionExtraction (
/**
Register LzmaDecompress handler.
Register LzmaDecompress and LzmaDecompressGetInfo handlers with LzmaCustomerDecompressGuid.
@retval RETURN_SUCCESS Register successfully.
@retval RETURN_OUT_OF_RESOURCES No enough memory to store this handler.

View File

@@ -1,8 +1,11 @@
#/** @file
# LZMA GUIDed Section Extraction Protocol Library
# LzmaCustomDecompressLib produces LZMA custom decompression algorithm.
#
# Uefi Decompression library instance
# Copyright (c) 2006, 2009, Intel Corporation.
# It is based on the LZMA SDK 4.65.
# LZMA SDK 4.65 was placed in the public domain on 2009-02-03.
# It was released on the http://www.7-zip.org/sdk.html website.
#
# Copyright (c) 2009, Intel Corporation.
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -21,9 +24,6 @@
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = BASE
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
CONSTRUCTOR = LzmaDecompressLibConstructor
#
@@ -37,13 +37,15 @@
Sdk/C/LzFind.c
Sdk/C/LzmaDec.c
GuidedSectionExtraction.c
UefiLzma.h
LzmaDecompressLibInternal.h
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
[Guids]
gLzmaCustomDecompressGuid
gLzmaCustomDecompressGuid ## PRODUCED ## GUID specifies LZMA custom decompress algorithm.
[LibraryClasses]
BaseLib

View File

@@ -1,11 +1,7 @@
/** @file
LZMA Decompress routines for edk2
LZMA Decompress interfaces
Portions based on LZMA SDK 4.65:
LzmaUtil.c -- Test application for LZMA compression
2008-11-23 : Igor Pavlov : Public domain
Copyright (c) 2006 - 2009, Intel Corporation<BR>
Copyright (c) 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -16,14 +12,7 @@
**/
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiDecompressLib.h>
#include <Library/ExtractGuidedSectionLib.h>
#include <Guid/LzmaDecompress.h>
#include "LzmaDecompressLibInternal.h"
#include "Sdk/C/Types.h"
#include "Sdk/C/7zVersion.h"
#include "Sdk/C/LzmaDec.h"
@@ -32,35 +21,35 @@
// Global data
//
STATIC CONST VOID *mSourceLastUsedWithGetInfo;
STATIC UINT32 mSizeOfLastSource;
STATIC UINT32 mDecompressedSizeForLastSource;
STATIC VOID *mScratchBuffer;
STATIC UINTN mScratchBufferSize;
CONST VOID *mSourceLastUsedWithGetInfo;
UINT32 mSizeOfLastSource;
UINT32 mDecompressedSizeForLastSource;
VOID *mScratchBuffer;
UINTN mScratchBufferSize;
#define SCRATCH_BUFFER_REQUEST_SIZE SIZE_64KB
/**
Allocation routine used by LZMA decompression.
@param p Pointer to the ISzAlloc instance
@param size The size in bytes to be allocated
@param P Pointer to the ISzAlloc instance
@param Size The size in bytes to be allocated
@return The allocated pointer address, or NULL on failure
**/
STATIC
VOID *
SzAlloc (
void *p,
size_t size
VOID *P,
size_t Size
)
{
VOID *addr;
VOID *Addr;
if (mScratchBufferSize >= size) {
addr = mScratchBuffer;
mScratchBuffer = (VOID*) ((UINT8*)addr + size);
mScratchBufferSize -= size;
return addr;
if (mScratchBufferSize >= Size) {
Addr = mScratchBuffer;
mScratchBuffer = (VOID*) ((UINT8*)Addr + Size);
mScratchBufferSize -= Size;
return Addr;
} else {
ASSERT (FALSE);
return NULL;
@@ -70,14 +59,13 @@ SzAlloc (
/**
Free routine used by LZMA decompression.
@param p Pointer to the ISzAlloc instance
@param address The address to be freed
@param P Pointer to the ISzAlloc instance
@param Address The address to be freed
**/
STATIC
VOID
SzFree (
void *p,
void *address
VOID *P,
VOID *Address
)
{
//
@@ -91,10 +79,16 @@ STATIC ISzAlloc g_Alloc = { SzAlloc, SzFree };
#define LZMA_HEADER_SIZE (LZMA_PROPS_SIZE + 8)
STATIC
/**
Get the size of the uncompressed buffer by parsing EncodeData header.
@param EncodedData Pointer to the compressed data.
@return The size of the uncompressed buffer.
**/
UINT64
GetDecodedSizeOfBuf(
UINT8 *encodedData
UINT8 *EncodedData
)
{
UINT64 DecodedSize;
@@ -103,25 +97,44 @@ GetDecodedSizeOfBuf(
/* Parse header */
DecodedSize = 0;
for (Index = LZMA_PROPS_SIZE + 7; Index >= LZMA_PROPS_SIZE; Index--)
DecodedSize = LShiftU64(DecodedSize, 8) + encodedData[Index];
DecodedSize = LShiftU64(DecodedSize, 8) + EncodedData[Index];
return DecodedSize;
}
//
// LZMA functions and data as defined in local LzmaDecompress.h
// LZMA functions and data as defined in local LzmaDecompressLibInternal.h
//
/**
The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
@param Source The source buffer containing the compressed data.
@param SourceSize The size of source buffer
@param DestinationSize The size of destination buffer.
@param ScratchSize The size of scratch buffer.
Given a Lzma compressed source buffer, this function retrieves the size of
the uncompressed buffer and the size of the scratch buffer required
to decompress the compressed source buffer.
Retrieves the size of the uncompressed buffer and the temporary scratch buffer
required to decompress the buffer specified by Source and SourceSize.
The size of the uncompressed buffer is returned in DestinationSize,
the size of the scratch buffer is returned in ScratchSize, and RETURN_SUCCESS is returned.
This function does not have scratch buffer available to perform a thorough
checking of the validity of the source data. It just retrieves the "Original Size"
field from the LZMA_HEADER_SIZE beginning bytes of the source data and output it as DestinationSize.
And ScratchSize is specific to the decompression implementation.
If SourceSize is less than LZMA_HEADER_SIZE, then ASSERT().
@param Source The source buffer containing the compressed data.
@param SourceSize The size, in bytes, of the source buffer.
@param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer
that will be generated when the compressed buffer specified
by Source and SourceSize is decompressed.
@param ScratchSize A pointer to the size, in bytes, of the scratch buffer that
is required to decompress the compressed buffer specified
by Source and SourceSize.
@retval RETURN_SUCCESS The size of the uncompressed data was returned
in DestinationSize and the size of the scratch
buffer was returned in ScratchSize.
@retval RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
@retval RETURN_INVALID_PARAMETER - The source data is corrupted
**/
RETURN_STATUS
EFIAPI
@@ -148,14 +161,25 @@ LzmaUefiDecompressGetInfo (
/**
The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
@param Source - The source buffer containing the compressed data.
@param Destination - The destination buffer to store the decompressed data
@param Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
Decompresses a Lzma compressed source buffer.
@retval RETURN_SUCCESS - Decompression is successfull
@retval RETURN_INVALID_PARAMETER - The source data is corrupted
Extracts decompressed data to its original form.
If the compressed source data specified by Source is successfully decompressed
into Destination, then RETURN_SUCCESS is returned. If the compressed source data
specified by Source is not in a valid compressed data format,
then RETURN_INVALID_PARAMETER is returned.
@param Source The source buffer containing the compressed data.
@param Destination The destination buffer to store the decompressed data
@param Scratch A temporary scratch buffer that is used to perform the decompression.
This is an optional parameter that may be NULL if the
required scratch buffer size is 0.
@retval RETURN_SUCCESS Decompression completed successfully, and
the uncompressed buffer is returned in Destination.
@retval RETURN_INVALID_PARAMETER
The source buffer specified by Source is corrupted
(not in a valid compressed format).
**/
RETURN_STATUS
EFIAPI
@@ -165,34 +189,34 @@ LzmaUefiDecompress (
IN OUT VOID *Scratch
)
{
SRes lzmaResult;
ELzmaStatus status;
SizeT decodedBufSize;
SizeT encodedDataSize;
SRes LzmaResult;
ELzmaStatus Status;
SizeT DecodedBufSize;
SizeT EncodedDataSize;
if (Source != mSourceLastUsedWithGetInfo) {
return RETURN_INVALID_PARAMETER;
}
decodedBufSize = (SizeT)mDecompressedSizeForLastSource;
encodedDataSize = (SizeT)(mSizeOfLastSource - LZMA_HEADER_SIZE);
DecodedBufSize = (SizeT)mDecompressedSizeForLastSource;
EncodedDataSize = (SizeT)(mSizeOfLastSource - LZMA_HEADER_SIZE);
mScratchBuffer = Scratch;
mScratchBufferSize = SCRATCH_BUFFER_REQUEST_SIZE;
lzmaResult = LzmaDecode(
LzmaResult = LzmaDecode(
Destination,
&decodedBufSize,
&DecodedBufSize,
(Byte*)((UINT8*)Source + LZMA_HEADER_SIZE),
&encodedDataSize,
&EncodedDataSize,
Source,
LZMA_PROPS_SIZE,
LZMA_FINISH_END,
&status,
&Status,
&g_Alloc
);
if (lzmaResult == SZ_OK) {
if (LzmaResult == SZ_OK) {
return RETURN_SUCCESS;
} else {
return RETURN_INVALID_PARAMETER;

View File

@@ -1,57 +0,0 @@
/** @file
LZMA Decompress Library header file
Copyright (c) 2006 - 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __LZMADECOMPRESS_H__
#define __LZMADECOMPRESS_H__
/**
The internal implementation of *_DECOMPRESS_PROTOCOL.GetInfo().
@param Source The source buffer containing the compressed data.
@param SourceSize The size of source buffer
@param DestinationSize The size of destination buffer.
@param ScratchSize The size of scratch buffer.
@retval RETURN_SUCCESS - The size of destination buffer and the size of scratch buffer are successull retrieved.
@retval RETURN_INVALID_PARAMETER - The source data is corrupted
**/
RETURN_STATUS
EFIAPI
LzmaUefiDecompressGetInfo (
IN CONST VOID *Source,
IN UINT32 SourceSize,
OUT UINT32 *DestinationSize,
OUT UINT32 *ScratchSize
);
/**
The internal implementation of *_DECOMPRESS_PROTOCOL.Decompress().
@param Source - The source buffer containing the compressed data.
@param Destination - The destination buffer to store the decompressed data
@param Scratch - The buffer used internally by the decompress routine. This buffer is needed to store intermediate data.
@retval RETURN_SUCCESS - Decompression is successfull
@retval RETURN_INVALID_PARAMETER - The source data is corrupted
**/
RETURN_STATUS
EFIAPI
LzmaUefiDecompress (
IN CONST VOID *Source,
IN OUT VOID *Destination,
IN OUT VOID *Scratch
);
#endif // __LZMADECOMPRESS_H__

View File

@@ -0,0 +1,94 @@
/** @file
LZMA Decompress Library internal header file declares Lzma decompress interfaces.
Copyright (c) 2009, Intel Corporation<BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __LZMADECOMPRESSLIB_INTERNAL_H__
#define __LZMADECOMPRESSLIB_INTERNAL_H__
#include <PiPei.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/ExtractGuidedSectionLib.h>
#include <Guid/LzmaDecompress.h>
/**
Given a Lzma compressed source buffer, this function retrieves the size of
the uncompressed buffer and the size of the scratch buffer required
to decompress the compressed source buffer.
Retrieves the size of the uncompressed buffer and the temporary scratch buffer
required to decompress the buffer specified by Source and SourceSize.
The size of the uncompressed buffer is returned in DestinationSize,
the size of the scratch buffer is returned in ScratchSize, and RETURN_SUCCESS is returned.
This function does not have scratch buffer available to perform a thorough
checking of the validity of the source data. It just retrieves the "Original Size"
field from the LZMA_HEADER_SIZE beginning bytes of the source data and output it as DestinationSize.
And ScratchSize is specific to the decompression implementation.
If SourceSize is less than LZMA_HEADER_SIZE, then ASSERT().
@param Source The source buffer containing the compressed data.
@param SourceSize The size, in bytes, of the source buffer.
@param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer
that will be generated when the compressed buffer specified
by Source and SourceSize is decompressed.
@param ScratchSize A pointer to the size, in bytes, of the scratch buffer that
is required to decompress the compressed buffer specified
by Source and SourceSize.
@retval RETURN_SUCCESS The size of the uncompressed data was returned
in DestinationSize and the size of the scratch
buffer was returned in ScratchSize.
**/
RETURN_STATUS
EFIAPI
LzmaUefiDecompressGetInfo (
IN CONST VOID *Source,
IN UINT32 SourceSize,
OUT UINT32 *DestinationSize,
OUT UINT32 *ScratchSize
);
/**
Decompresses a Lzma compressed source buffer.
Extracts decompressed data to its original form.
If the compressed source data specified by Source is successfully decompressed
into Destination, then RETURN_SUCCESS is returned. If the compressed source data
specified by Source is not in a valid compressed data format,
then RETURN_INVALID_PARAMETER is returned.
@param Source The source buffer containing the compressed data.
@param Destination The destination buffer to store the decompressed data
@param Scratch A temporary scratch buffer that is used to perform the decompression.
This is an optional parameter that may be NULL if the
required scratch buffer size is 0.
@retval RETURN_SUCCESS Decompression completed successfully, and
the uncompressed buffer is returned in Destination.
@retval RETURN_INVALID_PARAMETER
The source buffer specified by Source is corrupted
(not in a valid compressed format).
**/
RETURN_STATUS
EFIAPI
LzmaUefiDecompress (
IN CONST VOID *Source,
IN OUT VOID *Destination,
IN OUT VOID *Scratch
);
#endif

View File

@@ -1,5 +1,5 @@
/** @file
LZMA UEFI Library header file
LZMA UEFI header file
Allows LZMA code to build under UEFI (edk2) build environment