]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
Sync value for string opcode after call the Callback function.
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Setup.c
index 35bd04b16bc51d2d012d8bb0bf54e0f266217507..d7536e7ba539f26ed5a100aa00f971d923b67e0b 100644 (file)
@@ -2993,6 +2993,7 @@ GetQuestionDefault (
   EFI_HII_CONFIG_ACCESS_PROTOCOL  *ConfigAccess;\r
   EFI_BROWSER_ACTION_REQUEST      ActionRequest;\r
   INTN                            Action;\r
+  CHAR16                          *NewString;\r
 \r
   Status   = EFI_NOT_FOUND;\r
   StrValue = NULL;\r
@@ -3030,6 +3031,19 @@ GetQuestionDefault (
                              &ActionRequest\r
                              );\r
     if (!EFI_ERROR (Status)) {\r
+      if (HiiValue->Type == EFI_IFR_TYPE_STRING) {\r
+        NewString = GetToken (Question->HiiValue.Value.string, FormSet->HiiHandle);\r
+        ASSERT (NewString != NULL);\r
+\r
+        ASSERT (StrLen (NewString) * sizeof (CHAR16) <= Question->StorageWidth);\r
+        if (StrLen (NewString) * sizeof (CHAR16) <= Question->StorageWidth) {\r
+          CopyMem (Question->BufferValue, NewString, StrSize (NewString));\r
+        } else {\r
+          CopyMem (Question->BufferValue, NewString, Question->StorageWidth);\r
+        }\r
+\r
+        FreePool (NewString);\r
+      }\r
       return Status;\r
     }\r
   }\r
@@ -3307,7 +3321,7 @@ ExtractDefault (
         //\r
         // Call the Retrieve call back to get the initial question value.\r
         //\r
-        Status = ProcessRetrieveForQuestion(FormSet->ConfigAccess, Question);\r
+        Status = ProcessRetrieveForQuestion(FormSet->ConfigAccess, Question, FormSet);\r
       }\r
 \r
       //\r