Add support to original EFI_IFR_FORM_SET in initial UEFI2.1 spec. Now, it has been...
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 2 Feb 2010 01:37:48 +0000 (01:37 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 2 Feb 2010 01:37:48 +0000 (01:37 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk@9905 6f19259b-4bc3-4df7-8a09-765794883524

edk2/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c

index 8170f11..7dbbe85 100644 (file)
@@ -294,18 +294,25 @@ ExtractDisplayedHiiFormFromHiiHandle (
         OpCodeData = Package + Offset2;\r
 \r
         if (((EFI_IFR_OP_HEADER *) OpCodeData)->OpCode == EFI_IFR_FORM_SET_OP) {\r
-          //\r
-          // Find FormSet OpCode\r
-          //\r
-          ClassGuidNum = ((EFI_IFR_FORM_SET *) OpCodeData)->Flags;\r
-          ClassGuid = (EFI_GUID *) (VOID *)(OpCodeData + sizeof (EFI_IFR_FORM_SET));\r
-          while (ClassGuidNum-- > 0) {\r
-            if (CompareGuid (SetupClassGuid, ClassGuid)) {\r
-              CopyMem (FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));\r
-              CopyMem (FormSetHelp, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));\r
-              FreePool (HiiPackageList);\r
-              return TRUE;\r
+          if (((EFI_IFR_OP_HEADER *) OpCodeData)->Length > OFFSET_OF (EFI_IFR_FORM_SET, Flags)) {\r
+            //\r
+            // Find FormSet OpCode\r
+            //\r
+            ClassGuidNum = ((EFI_IFR_FORM_SET *) OpCodeData)->Flags;\r
+            ClassGuid = (EFI_GUID *) (VOID *)(OpCodeData + sizeof (EFI_IFR_FORM_SET));\r
+            while (ClassGuidNum-- > 0) {\r
+              if (CompareGuid (SetupClassGuid, ClassGuid)) {\r
+                CopyMem (FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));\r
+                CopyMem (FormSetHelp, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));\r
+                FreePool (HiiPackageList);\r
+                return TRUE;\r
+              }\r
             }\r
+           } else {\r
+             CopyMem (FormSetTitle, &((EFI_IFR_FORM_SET *) OpCodeData)->FormSetTitle, sizeof (EFI_STRING_ID));\r
+             CopyMem (FormSetHelp, &((EFI_IFR_FORM_SET *) OpCodeData)->Help, sizeof (EFI_STRING_ID));\r
+             FreePool (HiiPackageList);\r
+             return TRUE;\r
           }\r
         }\r
         \r