]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.c
Update ExtractGuidedSectionLib instance to cover the same handler is registered multi...
[mirror_edk2.git] / MdePkg / Library / DxeExtractGuidedSectionLib / DxeExtractGuidedSectionLib.c
index 164691389b3194c9272ecad4390af0d1a19465b3..acffa264fe3ec1a3913885db274db8d9a80b5142 100644 (file)
@@ -114,12 +114,32 @@ ExtractGuidedSectionRegisterHandlers (
   IN        EXTRACT_GUIDED_SECTION_DECODE_HANDLER    DecodeHandler\r
   )\r
 {\r
+  UINT32 Index;\r
   //\r
   // Check input paramter.\r
   //\r
   if (SectionGuid == NULL) {\r
     return RETURN_INVALID_PARAMETER;\r
   }\r
+\r
+  //\r
+  // Search the match registered GetInfo handler for the input guided section.\r
+  //\r
+  for (Index = 0; Index < mNumberOfExtractHandler; Index ++) {\r
+    if (CompareGuid (&mExtractHandlerGuidTable[Index], SectionGuid)) {\r
+      break;\r
+    }\r
+  }\r
+\r
+  //\r
+  // If the guided handler has been registered before, only update its handler.\r
+  //\r
+  if (Index < mNumberOfExtractHandler) {\r
+    mExtractDecodeHandlerTable [Index] = DecodeHandler;\r
+    mExtractGetInfoHandlerTable [Index] = GetInfoHandler;\r
+    return RETURN_SUCCESS;\r
+  }\r
+  \r
   //\r
   // Check the global table is enough to contain new Handler.\r
   //\r