]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Library / BaseExtractGuidedSectionLib / BaseExtractGuidedSectionLib.c
CommitLineData
b9d5a7f1
LG
1/** @file\r
2 Provide generic extract guided section functions.\r
3\r
30f001ca 4 Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
b9d5a7f1
LG
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
35a17154 8 http://opensource.org/licenses/bsd-license.php.\r
b9d5a7f1
LG
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <PiPei.h>\r
16\r
17#include <Library/DebugLib.h>\r
18#include <Library/PcdLib.h>\r
19#include <Library/BaseMemoryLib.h>\r
20#include <Library/ExtractGuidedSectionLib.h>\r
21\r
22#define EXTRACT_HANDLER_INFO_SIGNATURE SIGNATURE_32 ('E', 'G', 'S', 'I')\r
23\r
24typedef struct {\r
25 UINT32 Signature;\r
26 UINT32 NumberOfExtractHandler;\r
27 GUID *ExtractHandlerGuidTable;\r
28 EXTRACT_GUIDED_SECTION_DECODE_HANDLER *ExtractDecodeHandlerTable;\r
29 EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *ExtractGetInfoHandlerTable;\r
30} EXTRACT_GUIDED_SECTION_HANDLER_INFO;\r
31\r
32/**\r
33 HandlerInfo table address is set by PcdGuidedExtractHandlerTableAddress, which is used to store \r
34 the registered guid and Handler list. When it is initialized, it will be directly returned. \r
35 Or, HandlerInfo table will be initialized in this function.\r
36\r
58380e9c 37 @param[in, out] InfoPointer The pointer to the handler information structure.\r
b9d5a7f1
LG
38\r
39 @retval RETURN_SUCCESS HandlerInfo table can be used to store guid and function tables.\r
40 @retval RETURN_OUT_OF_RESOURCES HandlerInfo table address is not writable.\r
41**/\r
42RETURN_STATUS\r
43GetExtractGuidedSectionHandlerInfo (\r
44 IN OUT EXTRACT_GUIDED_SECTION_HANDLER_INFO **InfoPointer\r
45 )\r
46{\r
47 EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
48 \r
49 //\r
50 // Set the available memory address to handler info.\r
51 //\r
52 HandlerInfo = (EXTRACT_GUIDED_SECTION_HANDLER_INFO*)(VOID*)(UINTN) PcdGet64 (PcdGuidedExtractHandlerTableAddress);\r
3dbef428
ED
53 if (HandlerInfo == NULL) {\r
54 *InfoPointer = NULL;\r
55 return EFI_OUT_OF_RESOURCES;\r
56 }\r
b9d5a7f1
LG
57\r
58 //\r
58380e9c 59 // First check whether the handler information structure is initialized.\r
b9d5a7f1
LG
60 //\r
61 if (HandlerInfo->Signature == EXTRACT_HANDLER_INFO_SIGNATURE) {\r
62 //\r
58380e9c 63 // The handler information has been initialized and is returned.\r
b9d5a7f1
LG
64 //\r
65 *InfoPointer = HandlerInfo;\r
66 return RETURN_SUCCESS;\r
67 }\r
68\r
69 //\r
58380e9c 70 // Try to initialize the handler information structure\r
b9d5a7f1
LG
71 //\r
72 HandlerInfo->Signature = EXTRACT_HANDLER_INFO_SIGNATURE;\r
73 if (HandlerInfo->Signature != EXTRACT_HANDLER_INFO_SIGNATURE) {\r
74 //\r
58380e9c 75 // The handler information structure was not writeable because the memory is not ready.\r
b9d5a7f1
LG
76 //\r
77 *InfoPointer = NULL;\r
78 return RETURN_OUT_OF_RESOURCES;\r
79 }\r
80\r
81 //\r
82 // Init HandlerInfo structure\r
83 //\r
84 HandlerInfo->NumberOfExtractHandler = 0;\r
85 HandlerInfo->ExtractHandlerGuidTable = (GUID *) (HandlerInfo + 1);\r
86 HandlerInfo->ExtractDecodeHandlerTable = (EXTRACT_GUIDED_SECTION_DECODE_HANDLER *) (\r
87 (UINT8 *)HandlerInfo->ExtractHandlerGuidTable + \r
88 PcdGet32 (PcdMaximumGuidedExtractHandler) * sizeof (GUID)\r
89 );\r
90 HandlerInfo->ExtractGetInfoHandlerTable = (EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *) (\r
91 (UINT8 *)HandlerInfo->ExtractDecodeHandlerTable + \r
92 PcdGet32 (PcdMaximumGuidedExtractHandler) * \r
93 sizeof (EXTRACT_GUIDED_SECTION_DECODE_HANDLER)\r
94 );\r
95 *InfoPointer = HandlerInfo;\r
96 return RETURN_SUCCESS;\r
97}\r
98\r
99/**\r
100 Retrieve the list GUIDs that have been registered through ExtractGuidedSectionRegisterHandlers().\r
101\r
102 Sets ExtractHandlerGuidTable so it points at a callee allocated array of registered GUIDs.\r
103 The total number of GUIDs in the array are returned. Since the array of GUIDs is callee allocated\r
104 and caller must treat this array of GUIDs as read-only data. \r
105 If ExtractHandlerGuidTable is NULL, then ASSERT().\r
106\r
107 @param[out] ExtractHandlerGuidTable A pointer to the array of GUIDs that have been registered through\r
108 ExtractGuidedSectionRegisterHandlers().\r
109\r
35a17154 110 @return The number of the supported extract guided Handler.\r
b9d5a7f1
LG
111\r
112**/\r
113UINTN\r
114EFIAPI\r
115ExtractGuidedSectionGetGuidList (\r
116 OUT GUID **ExtractHandlerGuidTable\r
117 )\r
118{\r
119 RETURN_STATUS Status;\r
120 EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
121\r
122 ASSERT (ExtractHandlerGuidTable != NULL);\r
123\r
124 //\r
125 // Get all registered handler information\r
126 //\r
127 Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
128 if (RETURN_ERROR (Status)) {\r
129 *ExtractHandlerGuidTable = NULL;\r
130 return 0;\r
131 }\r
132\r
133 //\r
134 // Get GuidTable and Table Number\r
135 //\r
3dbef428 136 ASSERT (HandlerInfo != NULL);\r
b9d5a7f1
LG
137 *ExtractHandlerGuidTable = HandlerInfo->ExtractHandlerGuidTable;\r
138 return HandlerInfo->NumberOfExtractHandler;\r
139}\r
140\r
141/**\r
142 Registers handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and EXTRACT_GUIDED_SECTION_DECODE_HANDLER\r
143 for a specific GUID section type.\r
144\r
145 Registers the handlers specified by GetInfoHandler and DecodeHandler with the GUID specified by SectionGuid.\r
146 If the GUID value specified by SectionGuid has already been registered, then return RETURN_ALREADY_STARTED.\r
147 If there are not enough resources available to register the handlers then RETURN_OUT_OF_RESOURCES is returned.\r
148 \r
149 If SectionGuid is NULL, then ASSERT().\r
150 If GetInfoHandler is NULL, then ASSERT().\r
151 If DecodeHandler is NULL, then ASSERT().\r
152\r
153 @param[in] SectionGuid A pointer to the GUID associated with the the handlers\r
154 of the GUIDed section type being registered.\r
2fc59a00 155 @param[in] GetInfoHandler The pointer to a function that examines a GUIDed section and returns the\r
b9d5a7f1
LG
156 size of the decoded buffer and the size of an optional scratch buffer\r
157 required to actually decode the data in a GUIDed section.\r
2fc59a00 158 @param[in] DecodeHandler The pointer to a function that decodes a GUIDed section into a caller\r
b9d5a7f1
LG
159 allocated output buffer. \r
160\r
161 @retval RETURN_SUCCESS The handlers were registered.\r
162 @retval RETURN_OUT_OF_RESOURCES There are not enough resources available to register the handlers.\r
163\r
164**/\r
165RETURN_STATUS\r
166EFIAPI\r
167ExtractGuidedSectionRegisterHandlers (\r
168 IN CONST GUID *SectionGuid,\r
169 IN EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER GetInfoHandler,\r
170 IN EXTRACT_GUIDED_SECTION_DECODE_HANDLER DecodeHandler\r
171 )\r
172{\r
173 UINT32 Index;\r
174 RETURN_STATUS Status;\r
175 EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
176\r
177 //\r
3868d06d 178 // Check input parameter\r
b9d5a7f1
LG
179 //\r
180 ASSERT (SectionGuid != NULL);\r
181 ASSERT (GetInfoHandler != NULL);\r
182 ASSERT (DecodeHandler != NULL);\r
183\r
184 //\r
185 // Get the registered handler information\r
186 //\r
187 Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
188 if (RETURN_ERROR (Status)) {\r
189 return Status;\r
190 }\r
191\r
192 //\r
193 // Search the match registered GetInfo handler for the input guided section.\r
194 //\r
3dbef428 195 ASSERT (HandlerInfo != NULL);\r
b9d5a7f1
LG
196 for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
197 if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {\r
198 //\r
199 // If the guided handler has been registered before, only update its handler.\r
200 //\r
201 HandlerInfo->ExtractDecodeHandlerTable [Index] = DecodeHandler;\r
202 HandlerInfo->ExtractGetInfoHandlerTable [Index] = GetInfoHandler;\r
203 return RETURN_SUCCESS;\r
204 }\r
205 }\r
206\r
207 //\r
208 // Check the global table is enough to contain new Handler.\r
209 //\r
210 if (HandlerInfo->NumberOfExtractHandler >= PcdGet32 (PcdMaximumGuidedExtractHandler)) {\r
211 return RETURN_OUT_OF_RESOURCES;\r
212 }\r
213 \r
214 //\r
215 // Register new Handler and guid value.\r
216 //\r
217 CopyGuid (HandlerInfo->ExtractHandlerGuidTable + HandlerInfo->NumberOfExtractHandler, SectionGuid);\r
218 HandlerInfo->ExtractDecodeHandlerTable [HandlerInfo->NumberOfExtractHandler] = DecodeHandler;\r
219 HandlerInfo->ExtractGetInfoHandlerTable [HandlerInfo->NumberOfExtractHandler++] = GetInfoHandler;\r
220\r
221 return RETURN_SUCCESS;\r
222}\r
223\r
224/**\r
225 Retrieves a GUID from a GUIDed section and uses that GUID to select an associated handler of type\r
226 EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers().\r
227 The selected handler is used to retrieve and return the size of the decoded buffer and the size of an\r
228 optional scratch buffer required to actually decode the data in a GUIDed section.\r
229\r
230 Examines a GUIDed section specified by InputSection. \r
231 If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(),\r
232 then RETURN_UNSUPPORTED is returned. \r
233 If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler \r
234 of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers()\r
235 is used to retrieve the OututBufferSize, ScratchSize, and Attributes values. The return status from the handler of\r
236 type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER is returned.\r
237 \r
238 If InputSection is NULL, then ASSERT().\r
239 If OutputBufferSize is NULL, then ASSERT().\r
240 If ScratchBufferSize is NULL, then ASSERT().\r
241 If SectionAttribute is NULL, then ASSERT().\r
242\r
243 @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.\r
244 @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required if the buffer\r
245 specified by InputSection were decoded.\r
246 @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space if the buffer specified by\r
247 InputSection were decoded.\r
248 @param[out] SectionAttribute A pointer to the attributes of the GUIDed section. See the Attributes field of\r
249 EFI_GUID_DEFINED_SECTION in the PI Specification.\r
250\r
35a17154 251 @retval RETURN_SUCCESS Successfully retrieved the required information.\r
b9d5a7f1
LG
252 @retval RETURN_UNSUPPORTED The GUID from the section specified by InputSection does not match any of\r
253 the GUIDs registered with ExtractGuidedSectionRegisterHandlers().\r
254 @retval Others The return status from the handler associated with the GUID retrieved from\r
255 the section specified by InputSection.\r
256\r
257**/\r
258RETURN_STATUS\r
259EFIAPI\r
260ExtractGuidedSectionGetInfo (\r
261 IN CONST VOID *InputSection,\r
262 OUT UINT32 *OutputBufferSize,\r
263 OUT UINT32 *ScratchBufferSize,\r
264 OUT UINT16 *SectionAttribute \r
265 )\r
266{\r
267 UINT32 Index;\r
268 RETURN_STATUS Status;\r
269 EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
30f001ca 270 EFI_GUID *SectionDefinitionGuid;\r
b9d5a7f1
LG
271 \r
272 //\r
3868d06d 273 // Check input parameter\r
b9d5a7f1
LG
274 //\r
275 ASSERT (InputSection != NULL);\r
276 ASSERT (OutputBufferSize != NULL);\r
277 ASSERT (ScratchBufferSize != NULL);\r
278 ASSERT (SectionAttribute != NULL);\r
279\r
280 //\r
281 // Get all registered handler information.\r
282 //\r
283 Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
284 if (RETURN_ERROR (Status)) {\r
285 return Status;\r
286 }\r
287\r
30f001ca
SZ
288 if (IS_SECTION2 (InputSection)) {\r
289 SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
290 } else {\r
291 SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
292 }\r
293\r
b9d5a7f1
LG
294 //\r
295 // Search the match registered GetInfo handler for the input guided section.\r
296 //\r
3dbef428 297 ASSERT (HandlerInfo != NULL);\r
b9d5a7f1 298 for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
30f001ca 299 if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
b9d5a7f1 300 //\r
58380e9c 301 // Call the match handler to get information for the input section data.\r
b9d5a7f1
LG
302 //\r
303 return HandlerInfo->ExtractGetInfoHandlerTable [Index] (\r
304 InputSection,\r
305 OutputBufferSize,\r
306 ScratchBufferSize,\r
307 SectionAttribute\r
308 );\r
309 }\r
310 }\r
311\r
312 //\r
313 // Not found, the input guided section is not supported. \r
314 //\r
315 return RETURN_UNSUPPORTED;\r
316}\r
317\r
318/**\r
319 Retrieves the GUID from a GUIDed section and uses that GUID to select an associated handler of type\r
320 EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers().\r
321 The selected handler is used to decode the data in a GUIDed section and return the result in a caller\r
322 allocated output buffer.\r
323\r
324 Decodes the GUIDed section specified by InputSection. \r
325 If GUID for InputSection does not match any of the GUIDs registered through ExtractGuidedSectionRegisterHandlers(),\r
326 then RETURN_UNSUPPORTED is returned. \r
327 If the GUID of InputSection does match the GUID that this handler supports, then the the associated handler\r
328 of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER that was registered with ExtractGuidedSectionRegisterHandlers()\r
329 is used to decode InputSection into the buffer specified by OutputBuffer and the authentication status of this\r
330 decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the data in InputSection,\r
35a17154 331 then OutputBuffer is set to point at the data in InputSection. Otherwise, the decoded data will be placed in a caller\r
b9d5a7f1
LG
332 allocated buffer specified by OutputBuffer. This function is responsible for computing the EFI_AUTH_STATUS_PLATFORM_OVERRIDE\r
333 bit of in AuthenticationStatus. The return status from the handler of type EXTRACT_GUIDED_SECTION_DECODE_HANDLER is returned. \r
334 \r
335 If InputSection is NULL, then ASSERT().\r
336 If OutputBuffer is NULL, then ASSERT().\r
337 If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT().\r
338 If AuthenticationStatus is NULL, then ASSERT(). \r
339\r
340 @param[in] InputSection A pointer to a GUIDed section of an FFS formatted file.\r
341 @param[out] OutputBuffer A pointer to a buffer that contains the result of a decode operation. \r
342 @param[in] ScratchBuffer A caller allocated buffer that may be required by this function as a scratch buffer to perform the decode operation. \r
343 @param[out] AuthenticationStatus \r
344 A pointer to the authentication status of the decoded output buffer. See the definition\r
345 of authentication status in the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI section of the PI\r
346 Specification.\r
347\r
348 @retval RETURN_SUCCESS The buffer specified by InputSection was decoded.\r
349 @retval RETURN_UNSUPPORTED The section specified by InputSection does not match the GUID this handler supports.\r
350 @retval RETURN_INVALID_PARAMETER The section specified by InputSection can not be decoded.\r
351\r
352**/\r
353RETURN_STATUS\r
354EFIAPI\r
355ExtractGuidedSectionDecode (\r
356 IN CONST VOID *InputSection,\r
357 OUT VOID **OutputBuffer,\r
358 IN VOID *ScratchBuffer, OPTIONAL\r
359 OUT UINT32 *AuthenticationStatus \r
360 )\r
361{\r
362 UINT32 Index;\r
363 RETURN_STATUS Status;\r
364 EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
30f001ca 365 EFI_GUID *SectionDefinitionGuid;\r
b9d5a7f1
LG
366 \r
367 //\r
368 // Check input parameter\r
369 //\r
370 ASSERT (InputSection != NULL);\r
371 ASSERT (OutputBuffer != NULL);\r
372 ASSERT (AuthenticationStatus != NULL);\r
373\r
374 //\r
375 // Get all registered handler information.\r
376 // \r
377 Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
378 if (RETURN_ERROR (Status)) {\r
379 return Status;\r
380 }\r
381\r
30f001ca
SZ
382 if (IS_SECTION2 (InputSection)) {\r
383 SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION2 *) InputSection)->SectionDefinitionGuid);\r
384 } else {\r
385 SectionDefinitionGuid = &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid);\r
386 }\r
387\r
b9d5a7f1
LG
388 //\r
389 // Search the match registered Extract handler for the input guided section.\r
390 //\r
3dbef428 391 ASSERT (HandlerInfo != NULL);\r
b9d5a7f1 392 for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
30f001ca 393 if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionDefinitionGuid)) {\r
b9d5a7f1
LG
394 //\r
395 // Call the match handler to extract raw data for the input guided section.\r
396 //\r
397 return HandlerInfo->ExtractDecodeHandlerTable [Index] (\r
398 InputSection,\r
399 OutputBuffer,\r
400 ScratchBuffer,\r
401 AuthenticationStatus\r
402 );\r
403 }\r
404 }\r
405\r
406 //\r
407 // Not found, the input guided section is not supported. \r
408 //\r
409 return RETURN_UNSUPPORTED;\r
410}\r
9be899c5
ED
411\r
412/**\r
413 Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and \r
414 EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type.\r
415 \r
416 Retrieves the handlers associated with SectionGuid and returns them in \r
417 GetInfoHandler and DecodeHandler.\r
418\r
419 If the GUID value specified by SectionGuid has not been registered, then \r
420 return RETURN_NOT_FOUND.\r
421 \r
422 If SectionGuid is NULL, then ASSERT().\r
423\r
424 @param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed \r
425 section type being retrieved.\r
426 @param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns \r
427 the size of the decoded buffer and the size of an optional scratch \r
428 buffer required to actually decode the data in a GUIDed section. \r
429 This is an optional parameter that may be NULL. If it is NULL, then \r
430 the previously registered handler is not returned.\r
431 @param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller\r
432 allocated output buffer. This is an optional parameter that may be NULL.\r
433 If it is NULL, then the previously registered handler is not returned.\r
434\r
435 @retval RETURN_SUCCESS The handlers were retrieved.\r
436 @retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID.\r
437\r
438**/\r
439RETURN_STATUS\r
440EFIAPI\r
441ExtractGuidedSectionGetHandlers (\r
442 IN CONST GUID *SectionGuid,\r
443 OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler, OPTIONAL\r
444 OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL\r
445 )\r
446{\r
447 UINT32 Index;\r
448 RETURN_STATUS Status;\r
449 EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;\r
450\r
451 //\r
3868d06d 452 // Check input parameter\r
9be899c5
ED
453 //\r
454 ASSERT (SectionGuid != NULL);\r
455\r
456 //\r
457 // Get the registered handler information\r
458 //\r
459 Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);\r
460 if (RETURN_ERROR (Status)) {\r
461 return Status;\r
462 }\r
463\r
464 //\r
465 // Search the match registered GetInfo handler for the input guided section.\r
466 //\r
467 ASSERT (HandlerInfo != NULL);\r
468 for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {\r
469 if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {\r
470\r
471 //\r
472 // If the guided handler has been registered before, then return the registered handlers.\r
473 //\r
474 if (GetInfoHandler != NULL) {\r
475 *GetInfoHandler = HandlerInfo->ExtractGetInfoHandlerTable[Index];\r
476 }\r
477 if (DecodeHandler != NULL) {\r
478 *DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];\r
479 }\r
480 return RETURN_SUCCESS;\r
481 }\r
482 }\r
483 return RETURN_NOT_FOUND;\r
484}\r