TianoCore EDK2 master
Loading...
Searching...
No Matches
GuidedSectionExtraction.c
Go to the documentation of this file.
1
12
46RETURN_STATUS
47EFIAPI
49 IN CONST VOID *InputSection,
50 OUT UINT32 *OutputBufferSize,
51 OUT UINT32 *ScratchBufferSize,
52 OUT UINT16 *SectionAttribute
53 )
54{
55 ASSERT (InputSection != NULL);
56 ASSERT (OutputBufferSize != NULL);
57 ASSERT (ScratchBufferSize != NULL);
58 ASSERT (SectionAttribute != NULL);
59
60 if (IS_SECTION2 (InputSection)) {
61 if (!CompareGuid (
62 &gLzmaCustomDecompressGuid,
63 &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid)
64 ))
65 {
67 }
68
69 *SectionAttribute = ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->Attributes;
70
72 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
73 SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
74 OutputBufferSize,
75 ScratchBufferSize
76 );
77 } else {
78 if (!CompareGuid (
79 &gLzmaCustomDecompressGuid,
80 &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid)
81 ))
82 {
84 }
85
86 *SectionAttribute = ((EFI_GUID_DEFINED_SECTION *)InputSection)->Attributes;
87
89 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
90 SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
91 OutputBufferSize,
92 ScratchBufferSize
93 );
94 }
95}
96
130RETURN_STATUS
131EFIAPI
133 IN CONST VOID *InputSection,
134 OUT VOID **OutputBuffer,
135 OUT VOID *ScratchBuffer OPTIONAL,
136 OUT UINT32 *AuthenticationStatus
137 )
138{
139 ASSERT (OutputBuffer != NULL);
140 ASSERT (InputSection != NULL);
141
142 if (IS_SECTION2 (InputSection)) {
143 if (!CompareGuid (
144 &gLzmaCustomDecompressGuid,
145 &(((EFI_GUID_DEFINED_SECTION2 *)InputSection)->SectionDefinitionGuid)
146 ))
147 {
149 }
150
151 //
152 // Authentication is set to Zero, which may be ignored.
153 //
154 *AuthenticationStatus = 0;
155
156 return LzmaUefiDecompress (
157 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
158 SECTION2_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION2 *)InputSection)->DataOffset,
159 *OutputBuffer,
160 ScratchBuffer
161 );
162 } else {
163 if (!CompareGuid (
164 &gLzmaCustomDecompressGuid,
165 &(((EFI_GUID_DEFINED_SECTION *)InputSection)->SectionDefinitionGuid)
166 ))
167 {
169 }
170
171 //
172 // Authentication is set to Zero, which may be ignored.
173 //
174 *AuthenticationStatus = 0;
175
176 return LzmaUefiDecompress (
177 (UINT8 *)InputSection + ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
178 SECTION_SIZE (InputSection) - ((EFI_GUID_DEFINED_SECTION *)InputSection)->DataOffset,
179 *OutputBuffer,
180 ScratchBuffer
181 );
182 }
183}
184
192EFIAPI
194 VOID
195 )
196{
198 &gLzmaCustomDecompressGuid,
201 );
202}
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
EFI_STATUS EFIAPI LzmaDecompressLibConstructor(VOID)
RETURN_STATUS EFIAPI LzmaGuidedSectionExtraction(IN CONST VOID *InputSection, OUT VOID **OutputBuffer, OUT VOID *ScratchBuffer OPTIONAL, OUT UINT32 *AuthenticationStatus)
RETURN_STATUS EFIAPI LzmaGuidedSectionGetInfo(IN CONST VOID *InputSection, OUT UINT32 *OutputBufferSize, OUT UINT32 *ScratchBufferSize, OUT UINT16 *SectionAttribute)
RETURN_STATUS EFIAPI LzmaUefiDecompress(IN CONST VOID *Source, IN UINTN SourceSize, IN OUT VOID *Destination, IN OUT VOID *Scratch)
RETURN_STATUS EFIAPI LzmaUefiDecompressGetInfo(IN CONST VOID *Source, IN UINT32 SourceSize, OUT UINT32 *DestinationSize, OUT UINT32 *ScratchSize)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define RETURN_INVALID_PARAMETER
Definition: Base.h:1076
#define SECTION_SIZE(SectionHeaderPtr)
RETURN_STATUS EFIAPI ExtractGuidedSectionRegisterHandlers(IN CONST GUID *SectionGuid, IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler, IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29