diff options
author | Eric Dong <eric.dong@intel.com> | 2014-04-11 06:15:57 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-04-11 06:15:57 +0000 |
commit | 061d5462249664ba32d87803365c3355614b35b8 (patch) | |
tree | 4d80941054ed6d8f5be15811cdc50f0d68a5e22a | |
parent | 66a5771e7a6de31841f68fa7ac9545846d6d382a (diff) | |
download | edk2-platforms-061d5462249664ba32d87803365c3355614b35b8.tar.xz |
Sync value for string opcode after call the Callback function.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming, Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15448 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c | 35 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 16 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 4 |
3 files changed, 52 insertions, 3 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c index b3a3d23761..8f67f86446 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c @@ -2092,6 +2092,7 @@ ProcessCallBackFunction ( BROWSER_SETTING_SCOPE SettingLevel;
EFI_IFR_TYPE_VALUE BackUpValue;
UINT8 *BackUpBuffer;
+ CHAR16 *NewString;
ConfigAccess = FormSet->ConfigAccess;
SubmitFormIsRequired = FALSE;
@@ -2210,6 +2211,22 @@ ProcessCallBackFunction ( }
//
+ // Need to sync the value between Statement->HiiValue->Value and Statement->BufferValue
+ //
+ if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
+ NewString = GetToken (Statement->HiiValue.Value.string, FormSet->HiiHandle);
+ ASSERT (NewString != NULL);
+
+ ASSERT (StrLen (NewString) * sizeof (CHAR16) <= Statement->StorageWidth);
+ if (StrLen (NewString) * sizeof (CHAR16) <= Statement->StorageWidth) {
+ CopyMem (Statement->BufferValue, NewString, StrSize (NewString));
+ } else {
+ CopyMem (Statement->BufferValue, NewString, Statement->StorageWidth);
+ }
+ FreePool (NewString);
+ }
+
+ //
// According the spec, return value from call back of "changing" and
// "retrieve" should update to the question's temp buffer.
//
@@ -2277,6 +2294,7 @@ ProcessCallBackFunction ( @param ConfigAccess The config access protocol produced by the hii driver.
@param Statement The Question which need to call.
+ @param FormSet The formset this question belong to.
@retval EFI_SUCCESS The call back function excutes successfully.
@return Other value if the call back function failed to excute.
@@ -2284,13 +2302,15 @@ ProcessCallBackFunction ( EFI_STATUS
ProcessRetrieveForQuestion (
IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess,
- IN FORM_BROWSER_STATEMENT *Statement
+ IN FORM_BROWSER_STATEMENT *Statement,
+ IN FORM_BROWSER_FORMSET *FormSet
)
{
EFI_STATUS Status;
EFI_BROWSER_ACTION_REQUEST ActionRequest;
EFI_HII_VALUE *HiiValue;
EFI_IFR_TYPE_VALUE *TypeValue;
+ CHAR16 *NewString;
Status = EFI_SUCCESS;
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
@@ -2317,6 +2337,19 @@ ProcessRetrieveForQuestion ( TypeValue,
&ActionRequest
);
+ if (!EFI_ERROR (Status) && HiiValue->Type == EFI_IFR_TYPE_STRING) {
+ NewString = GetToken (Statement->HiiValue.Value.string, FormSet->HiiHandle);
+ ASSERT (NewString != NULL);
+
+ ASSERT (StrLen (NewString) * sizeof (CHAR16) <= Statement->StorageWidth);
+ if (StrLen (NewString) * sizeof (CHAR16) <= Statement->StorageWidth) {
+ CopyMem (Statement->BufferValue, NewString, StrSize (NewString));
+ } else {
+ CopyMem (Statement->BufferValue, NewString, Statement->StorageWidth);
+ }
+ FreePool (NewString);
+ }
+
return Status;
}
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index 35bd04b16b..d7536e7ba5 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -2993,6 +2993,7 @@ GetQuestionDefault ( EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
EFI_BROWSER_ACTION_REQUEST ActionRequest;
INTN Action;
+ CHAR16 *NewString;
Status = EFI_NOT_FOUND;
StrValue = NULL;
@@ -3030,6 +3031,19 @@ GetQuestionDefault ( &ActionRequest
);
if (!EFI_ERROR (Status)) {
+ if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
+ NewString = GetToken (Question->HiiValue.Value.string, FormSet->HiiHandle);
+ ASSERT (NewString != NULL);
+
+ ASSERT (StrLen (NewString) * sizeof (CHAR16) <= Question->StorageWidth);
+ if (StrLen (NewString) * sizeof (CHAR16) <= Question->StorageWidth) {
+ CopyMem (Question->BufferValue, NewString, StrSize (NewString));
+ } else {
+ CopyMem (Question->BufferValue, NewString, Question->StorageWidth);
+ }
+
+ FreePool (NewString);
+ }
return Status;
}
}
@@ -3307,7 +3321,7 @@ ExtractDefault ( //
// Call the Retrieve call back to get the initial question value.
//
- Status = ProcessRetrieveForQuestion(FormSet->ConfigAccess, Question);
+ Status = ProcessRetrieveForQuestion(FormSet->ConfigAccess, Question, FormSet);
}
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h index 50ab1fa6fd..b47c402c9e 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -1205,6 +1205,7 @@ ProcessCallBackFunction ( @param ConfigAccess The config access protocol produced by the hii driver.
@param Statement The Question which need to call.
+ @param FormSet The formset this question belong to.
@retval EFI_SUCCESS The call back function excutes successfully.
@return Other value if the call back function failed to excute.
@@ -1212,7 +1213,8 @@ ProcessCallBackFunction ( EFI_STATUS
ProcessRetrieveForQuestion (
IN EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess,
- IN FORM_BROWSER_STATEMENT *Statement
+ IN FORM_BROWSER_STATEMENT *Statement,
+ IN FORM_BROWSER_FORMSET *FormSet
);
/**
|