Intel Extensible Firmware Interface User Manual

Page 995

Advertising
background image

Decompression Source Code

Version 1.10

12/01/02

I-3

Arguments:

This - Protocol instance pointer.
Source - The source buffer containing the compressed data.
SrcSize - The size of source buffer
DstSize - The size of destination buffer.
ScratchSize - The size of scratch buffer.

Returns:

EFI_SUCCESS - The size of destination buffer and the size of
scratch buffer are successull retrieved.
EFI_INVALID_PARAMETER - The source data is corrupted

--*/
{
UINT8 *Src;

*ScratchSize = sizeof (SCRATCH_DATA);

Src = Source;
if (SrcSize < 8) {
return EFI_INVALID_PARAMETER;
}

*DstSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
return EFI_SUCCESS;
}


EFI_STATUS
EFIAPI
Decompress (
IN EFI_DECOMPRESS_PROTOCOL *This,
IN VOID *Source,
IN UINT32 SrcSize,
IN OUT VOID *Destination,
IN UINT32 DstSize,
IN OUT VOID *Scratch,
IN UINT32 ScratchSize
)
/*++

Routine Description:

The implementation of EFI_DECOMPRESS_PROTOCOL.Decompress().

Arguments:

This - The protocol instance.
Source - The source buffer containing the compressed data.
SrcSize - The size of the source buffer
Destination - The destination buffer to store the decompressed data
DstSize - The size of the destination buffer.
Scratch - The buffer used internally by the decompress routine. This
buffer is needed to store intermediate data.
ScratchSize - The size of scratch buffer.

Advertising