]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/UefiHiiLib/HiiLib.c
Correct the typo in comments.
[mirror_edk2.git] / MdeModulePkg / Library / UefiHiiLib / HiiLib.c
index 06c345b128aef3cd23318d3fc1325ba07767fe2f..f87ab8233c9343d5c21a90de34e8a5276de2e8f3 100644 (file)
@@ -921,16 +921,17 @@ InternalHiiGetValueOfNumber (
 }\r
 \r
 /**\r
-  This function shares the same logic to parse ConfigAltResp string \r
-  for setting default value and validating current setting.\r
-\r
-  @param ConfigResp         \r
-  @param HiiPackageList     \r
-  @param PackageListLength  \r
-  @param VarGuid\r
-  @param VarName\r
+  This internal function parses IFR data to validate current setting.\r
+\r
+  @param ConfigResp         ConfigResp string contains the current setting.\r
+  @param HiiPackageList     Point to Hii package list.\r
+  @param PackageListLength  The length of the pacakge.\r
+  @param VarGuid            Guid of the buffer storage.\r
+  @param VarName            Name of the buffer storage.\r
   \r
-  @retval EFI_SUCCESS\r
+  @retval EFI_SUCCESS            The current setting is valid.\r
+  @retval EFI_OUT_OF_RESOURCES   The memory is not enough.\r
+  @retval EFI_INVALID_PARAMETER  The config string or the Hii package is invalid.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -1214,7 +1215,7 @@ InternalHiiValidateCurrentSetting (
           }\r
           //\r
           // Find the matched VarStoreId to the input VarGuid and VarName\r
-          //            \r
+          //\r
           IfrVarStore = (EFI_IFR_VARSTORE *) IfrOpHdr;\r
           if (CompareGuid ((EFI_GUID *) (VOID *) &IfrVarStore->Guid, VarGuid)) {\r
             VarStoreName = (CHAR8 *) IfrVarStore->Name;\r
@@ -1244,10 +1245,17 @@ InternalHiiValidateCurrentSetting (
           break;\r
         case EFI_IFR_ONE_OF_OP:\r
           //\r
-          // Check whether current value is the one of option. \r
+          // Check whether current value is the one of option.\r
           //\r
 \r
           //\r
+          // OneOf question is not in IFR Form. This IFR form is not valid. \r
+          //\r
+          if (IfrVarStore == NULL) {\r
+            Status = EFI_INVALID_PARAMETER;\r
+            goto Done;\r
+          }\r
+          // \r
           // Check whether this question is for the requested varstore.\r
           //\r
           IfrOneOf = (EFI_IFR_ONE_OF *) IfrOpHdr;\r
@@ -1298,6 +1306,13 @@ InternalHiiValidateCurrentSetting (
           // Check the current value is in the numeric range.\r
           //\r
 \r
+          //\r
+          // Numeric question is not in IFR Form. This IFR form is not valid. \r
+          //\r
+          if (IfrVarStore == NULL) {\r
+            Status = EFI_INVALID_PARAMETER;\r
+            goto Done;\r
+          }\r
           //\r
           // Check whether this question is for the requested varstore.\r
           //\r
@@ -1381,6 +1396,14 @@ InternalHiiValidateCurrentSetting (
           // Check value is BOOLEAN type, only 0 and 1 is valid.\r
           //\r
 \r
+          //\r
+          // CheckBox question is not in IFR Form. This IFR form is not valid. \r
+          //\r
+          if (IfrVarStore == NULL) {\r
+            Status = EFI_INVALID_PARAMETER;\r
+            goto Done;\r
+          }\r
+\r
           //\r
           // Check whether this question is for the requested varstore.\r
           //\r
@@ -1428,6 +1451,14 @@ InternalHiiValidateCurrentSetting (
           // Check current string length is less than maxsize\r
           //\r
 \r
+          //\r
+          // CheckBox question is not in IFR Form. This IFR form is not valid. \r
+          //\r
+          if (IfrVarStore == NULL) {\r
+            Status = EFI_INVALID_PARAMETER;\r
+            goto Done;\r
+          }\r
+\r
           //\r
           // Check whether this question is for the requested varstore.\r
           //\r
@@ -1506,7 +1537,7 @@ InternalHiiValidateCurrentSetting (
           //\r
           // OneOf value doesn't belong to one of option value. \r
           //\r
-          if (VarBlockData.OpCode == EFI_IFR_ONE_OF_OP) {\r
+          if ((VarBlockData.Scope == 0) && (VarBlockData.OpCode == EFI_IFR_ONE_OF_OP)) {\r
             Status = EFI_INVALID_PARAMETER;\r
             goto Done;\r
           }\r
@@ -1558,9 +1589,9 @@ Done:
 }\r
 \r
 /**\r
-  This function shares the same logic to parse ConfigAltResp string \r
-  for setting default value and validating current setting.\r
-  \r
+  This function parses the input ConfigRequest string and its matched IFR code\r
+  string for setting default value and validating current setting.\r
+\r
   1. For setting default action, Reset the default value specified by DefaultId \r
   to the driver configuration got by Request string.\r
   2. For validating current setting, Validate the current configuration \r
@@ -1743,7 +1774,7 @@ InternalHiiIfrValueAction (
       // Its default value and validating can't execute by parsing IFR data.\r
       // Directly jump into the next ConfigAltResp string for another pair Guid, Name, and Path.   \r
       //\r
-         Status = EFI_SUCCESS;\r
+           Status = EFI_SUCCESS;\r
       goto NextConfigAltResp;\r
     }\r
     \r
@@ -1998,7 +2029,7 @@ Done:
 /**\r
   Validate the current configuration by parsing HII form IFR opcode.\r
 \r
-  NULL request string support depends on the ExtractConfig interface of\r
+  NULL request string support depends on the ExportConfig interface of\r
   HiiConfigRouting protocol in UEFI specification.\r
   \r
   @param  Request   A null-terminated Unicode string in \r