]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c
MdeModulePkg/BdsDxe: Revert "fall back to UI loop before hanging"
[mirror_edk2.git] / MdeModulePkg / Universal / DisplayEngineDxe / ProcessOptions.c
index f55fb2e26361270f215786596bb2d2bcf5d141e6..709dabc7f556c360b0cc8c134e59f3fe5529966d 100644 (file)
@@ -2,7 +2,7 @@
 Implementation for handling the User Interface option processing.\r
 \r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -21,6 +21,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   Concatenate a narrow string to another string.\r
 \r
   @param Destination The destination string.\r
+  @param DestMax     The Max length of destination string.\r
   @param Source      The source string. The string to be concatenated.\r
                      to the end of Destination.\r
 \r
@@ -101,8 +102,8 @@ HiiValueToUINT64 (
 \r
 /**\r
   Check whether this value type can be transfer to EFI_IFR_TYPE_BUFFER type.\r
-  \r
-  EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to \r
+\r
+  EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to\r
   EFI_IFR_TYPE_BUFFER when do the value compare.\r
 \r
   @param  Value                  Expression value to compare on.\r
@@ -157,8 +158,8 @@ IsTypeInUINT64 (
 \r
 /**\r
   Return the buffer length and buffer pointer for this value.\r
-  \r
-  EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to \r
+\r
+  EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to\r
   EFI_IFR_TYPE_BUFFER when do the value compare.\r
 \r
   @param  Value                  Expression value to compare on.\r
@@ -284,7 +285,7 @@ CompareHiiValue (
       *Result = Buf1Len > Buf2Len ? 1 : -1;\r
     }\r
     return EFI_SUCCESS;\r
-  }  \r
+  }\r
 \r
   //\r
   // Take remain types(integer, boolean, date/time) as integer\r
@@ -332,7 +333,7 @@ ValueToOption (
     ZeroMem (&Value, sizeof (EFI_HII_VALUE));\r
     Value.Type = Option->OptionOpCode->Type;\r
     CopyMem (&Value.Value, &Option->OptionOpCode->Value, Option->OptionOpCode->Header.Length - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));\r
-    \r
+\r
     if ((CompareHiiValue (&Value, OptionValue, &Result, NULL) == EFI_SUCCESS) && (Result == 0)) {\r
       return Option;\r
     }\r
@@ -440,12 +441,12 @@ SetArrayData (
   @param  Type                   Type of the data in this array.\r
   @param  Value                  The value to be find.\r
   @param  Index                  The index in the array which has same value with Value.\r
-  \r
+\r
   @retval   TRUE Found the value in the array.\r
   @retval   FALSE Not found the value.\r
 \r
 **/\r
-BOOLEAN \r
+BOOLEAN\r
 FindArrayData (\r
   IN VOID                     *Array,\r
   IN UINT8                    Type,\r
@@ -456,7 +457,7 @@ FindArrayData (
   UINTN  Count;\r
   UINT64 TmpValue;\r
   UINT64 ValueComp;\r
-  \r
+\r
   ASSERT (Array != NULL);\r
 \r
   Count    = 0;\r
@@ -567,7 +568,6 @@ PrintFormattedNumber (
 \r
   default:\r
     return EFI_UNSUPPORTED;\r
-    break;\r
   }\r
 \r
   UnicodeSPrint (FormattedNumber, BufferSize, Format, Value);\r
@@ -804,7 +804,7 @@ PasswordProcess (
 \r
   StringPtr = AllocateZeroPool ((Maximum + 1) * sizeof (CHAR16));\r
   ASSERT (StringPtr);\r
-  \r
+\r
   //\r
   // Use a NULL password to test whether old password is required\r
   //\r
@@ -812,8 +812,13 @@ PasswordProcess (
   Status = Question->PasswordCheck (gFormData, Question, StringPtr);\r
   if (Status == EFI_NOT_AVAILABLE_YET || Status == EFI_UNSUPPORTED) {\r
     //\r
-    // Password can't be set now. \r
+    // Password can't be set now.\r
     //\r
+    if (Status == EFI_UNSUPPORTED) {\r
+      do {\r
+        CreateDialog (&Key, gEmptyString, gPasswordUnsupported, gPressEnter, gEmptyString, NULL);\r
+      } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+    }\r
     FreePool (StringPtr);\r
     return EFI_SUCCESS;\r
   }\r
@@ -846,7 +851,7 @@ PasswordProcess (
       return Status;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Ask for new password\r
   //\r
@@ -860,7 +865,7 @@ PasswordProcess (
     FreePool (StringPtr);\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Confirm new password\r
   //\r
@@ -876,33 +881,23 @@ PasswordProcess (
     FreePool (TempString);\r
     return Status;\r
   }\r
-  \r
+\r
   //\r
   // Compare two typed-in new passwords\r
   //\r
-  if (StrCmp (StringPtr, TempString) == 0) {     \r
+  if (StrCmp (StringPtr, TempString) == 0) {\r
     gUserInput->InputValue.Buffer = AllocateCopyPool (Question->CurrentValue.BufferLen, StringPtr);\r
     gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;\r
     gUserInput->InputValue.Type = Question->CurrentValue.Type;\r
     gUserInput->InputValue.Value.string = HiiSetString(gFormData->HiiHandle, gUserInput->InputValue.Value.string, StringPtr, NULL);\r
-    FreePool (StringPtr); \r
 \r
     Status = EFI_SUCCESS;\r
-\r
-    if (EFI_ERROR (Status)) {\r
-      //\r
-      // Reset state machine for password\r
-      //\r
-      Question->PasswordCheck (gFormData, Question, NULL);\r
-    }\r
-\r
-    return Status;\r
   } else {\r
     //\r
     // Reset state machine for password\r
     //\r
     Question->PasswordCheck (gFormData, Question, NULL);\r
-  \r
+\r
     //\r
     // Two password mismatch, prompt error message\r
     //\r
@@ -912,7 +907,8 @@ PasswordProcess (
 \r
     Status = EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+  ZeroMem (TempString, (Maximum + 1) * sizeof (CHAR16));\r
+  ZeroMem (StringPtr, (Maximum + 1) * sizeof (CHAR16));\r
   FreePool (TempString);\r
   FreePool (StringPtr);\r
 \r
@@ -1043,7 +1039,7 @@ ProcessOptions (
           gUserInput->InputValue.Buffer    = ValueArray;\r
           gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;\r
           gUserInput->InputValue.Type      = Question->CurrentValue.Type;\r
-          \r
+\r
           Link = GetFirstNode (&Question->OptionListHead);\r
           Index2 = 0;\r
           while (!IsNull (&Question->OptionListHead, Link) && Index2 < OrderList->MaxContainers) {\r
@@ -1129,7 +1125,7 @@ ProcessOptions (
           gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;\r
           gUserInput->InputValue.Type      = Question->CurrentValue.Type;\r
         }\r
-       \r
+\r
         SetArrayData (ValueArray, ValueType, Index++, OneOfOption->OptionOpCode->Value.u64);\r
       }\r
 \r
@@ -1163,7 +1159,7 @@ ProcessOptions (
         if (SkipErrorValue) {\r
           //\r
           // Not report error, just get the correct option string info.\r
-          //          \r
+          //\r
           Link = GetFirstNode (&Question->OptionListHead);\r
           OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);\r
         } else {\r
@@ -1231,7 +1227,7 @@ ProcessOptions (
       // Perform inconsistent check\r
       //\r
       return EFI_SUCCESS;\r
-    } else {    \r
+    } else {\r
       *OptionString = AllocateZeroPool (BufferSize);\r
       ASSERT (*OptionString);\r
 \r
@@ -1368,7 +1364,7 @@ ProcessOptions (
         FreePool (StringPtr);\r
         return Status;\r
       }\r
-      \r
+\r
       gUserInput->InputValue.Buffer = AllocateCopyPool (Question->CurrentValue.BufferLen, StringPtr);\r
       gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;\r
       gUserInput->InputValue.Type = Question->CurrentValue.Type;\r
@@ -1470,5 +1466,5 @@ ProcessHelpString (
     FreePool (OutputString);\r
   }\r
 \r
-  return TotalRowNum; \r
+  return TotalRowNum;\r
 }\r