Add API to ExtractGuidedSectionLib.h to retrieve the set of registered handlers.
API Function name is ExtractGuidedSectionGetHandlers. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11002 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -386,3 +386,77 @@ ExtractGuidedSectionDecode (
|
||||
//
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves handlers of type EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER and
|
||||
EXTRACT_GUIDED_SECTION_DECODE_HANDLER for a specific GUID section type.
|
||||
|
||||
Retrieves the handlers associated with SectionGuid and returns them in
|
||||
GetInfoHandler and DecodeHandler.
|
||||
|
||||
If the GUID value specified by SectionGuid has not been registered, then
|
||||
return RETURN_NOT_FOUND.
|
||||
|
||||
If SectionGuid is NULL, then ASSERT().
|
||||
|
||||
@param[in] SectionGuid A pointer to the GUID associated with the handlersof the GUIDed
|
||||
section type being retrieved.
|
||||
@param[out] GetInfoHandler Pointer to a function that examines a GUIDed section and returns
|
||||
the size of the decoded buffer and the size of an optional scratch
|
||||
buffer required to actually decode the data in a GUIDed section.
|
||||
This is an optional parameter that may be NULL. If it is NULL, then
|
||||
the previously registered handler is not returned.
|
||||
@param[out] DecodeHandler Pointer to a function that decodes a GUIDed section into a caller
|
||||
allocated output buffer. This is an optional parameter that may be NULL.
|
||||
If it is NULL, then the previously registered handler is not returned.
|
||||
|
||||
@retval RETURN_SUCCESS The handlers were retrieved.
|
||||
@retval RETURN_NOT_FOUND No handlers have been registered with the specified GUID.
|
||||
|
||||
**/
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
ExtractGuidedSectionGetHandlers (
|
||||
IN CONST GUID *SectionGuid,
|
||||
OUT EXTRACT_GUIDED_SECTION_GET_INFO_HANDLER *GetInfoHandler, OPTIONAL
|
||||
OUT EXTRACT_GUIDED_SECTION_DECODE_HANDLER *DecodeHandler OPTIONAL
|
||||
)
|
||||
{
|
||||
UINT32 Index;
|
||||
RETURN_STATUS Status;
|
||||
EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo;
|
||||
|
||||
//
|
||||
// Check input paramter
|
||||
//
|
||||
ASSERT (SectionGuid != NULL);
|
||||
|
||||
//
|
||||
// Get the registered handler information
|
||||
//
|
||||
Status = GetExtractGuidedSectionHandlerInfo (&HandlerInfo);
|
||||
if (RETURN_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Search the match registered GetInfo handler for the input guided section.
|
||||
//
|
||||
ASSERT (HandlerInfo != NULL);
|
||||
for (Index = 0; Index < HandlerInfo->NumberOfExtractHandler; Index ++) {
|
||||
if (CompareGuid (HandlerInfo->ExtractHandlerGuidTable + Index, SectionGuid)) {
|
||||
|
||||
//
|
||||
// If the guided handler has been registered before, then return the registered handlers.
|
||||
//
|
||||
if (GetInfoHandler != NULL) {
|
||||
*GetInfoHandler = HandlerInfo->ExtractGetInfoHandlerTable[Index];
|
||||
}
|
||||
if (DecodeHandler != NULL) {
|
||||
*DecodeHandler = HandlerInfo->ExtractDecodeHandlerTable[Index];
|
||||
}
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
}
|
||||
return RETURN_NOT_FOUND;
|
||||
}
|
||||
|
Reference in New Issue
Block a user