Revision: 14673
http://sourceforge.net/p/edk2/code/14673
Author: ydong10
Date: 2013-09-16 07:57:06 +0000 (Mon, 16 Sep 2013)
Log Message:
-----------
Refine question value update logic.
Signed-off-by: Eric Dong <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Modified Paths:
--------------
trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
Modified: trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
===================================================================
--- trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
2013-09-16 02:20:52 UTC (rev 14672)
+++ trunk/edk2/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
2013-09-16 07:57:06 UTC (rev 14673)
@@ -1618,9 +1618,6 @@
CopyMem (&Statement->HiiValue, &UserInput->InputValue, sizeof
(EFI_HII_VALUE));
break;
}
- if (Statement->Operand != EFI_IFR_PASSWORD_OP) {
- SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form,
Statement, GetSetValueWithEditBuffer);
- }
break;
}
}
@@ -2012,6 +2009,8 @@
BOOLEAN NeedExit;
LIST_ENTRY *Link;
BROWSER_SETTING_SCOPE SettingLevel;
+ EFI_IFR_TYPE_VALUE BackUpValue;
+ UINT8 *BackUpBuffer;
ConfigAccess = Selection->FormSet->ConfigAccess;
SubmitFormIsRequired = FALSE;
@@ -2020,6 +2019,7 @@
NeedExit = FALSE;
Status = EFI_SUCCESS;
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
+ BackUpBuffer = NULL;
if (ConfigAccess == NULL) {
return EFI_SUCCESS;
@@ -2058,7 +2058,18 @@
//
TypeValue = (EFI_IFR_TYPE_VALUE *) Statement->BufferValue;
}
-
+
+ //
+ // If EFI_BROWSER_ACTION_CHANGING type, back up the new question value.
+ //
+ if (Action == EFI_BROWSER_ACTION_CHANGING) {
+ if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
+ BackUpBuffer = AllocateCopyPool(Statement->StorageWidth +
sizeof(CHAR16), Statement->BufferValue);
+ } else {
+ CopyMem (&BackUpValue, &HiiValue->Value, sizeof (EFI_IFR_TYPE_VALUE));
+ }
+ }
+
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
Status = ConfigAccess->Callback (
ConfigAccess,
@@ -2126,10 +2137,26 @@
}
} else {
//
+ // If the callback returns EFI_UNSUPPORTED for
EFI_BROWSER_ACTION_CHANGING,
+ // then the browser will use the value passed to Callback() and ignore
the
+ // value returned by Callback().
+ //
+ if (Action == EFI_BROWSER_ACTION_CHANGING && Status == EFI_UNSUPPORTED)
{
+ if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {
+ CopyMem (Statement->BufferValue, BackUpBuffer,
Statement->StorageWidth + sizeof(CHAR16));
+ } else {
+ CopyMem (&HiiValue->Value, &BackUpValue, sizeof
(EFI_IFR_TYPE_VALUE));
+ }
+
+ SetQuestionValue(Selection->FormSet, Selection->Form, Statement,
GetSetValueWithEditBuffer);
+ }
+
+ //
// According the spec, return fail from call back of "changing" and
// "retrieve", should restore the question's value.
//
- if (Action == EFI_BROWSER_ACTION_CHANGING || Action ==
EFI_BROWSER_ACTION_RETRIEVE) {
+ if ((Action == EFI_BROWSER_ACTION_CHANGING && Status != EFI_UNSUPPORTED)
||
+ Action == EFI_BROWSER_ACTION_RETRIEVE) {
GetQuestionValue(Selection->FormSet, Selection->Form, Statement,
GetSetValueWithEditBuffer);
}
@@ -2140,6 +2167,10 @@
Status = EFI_SUCCESS;
}
}
+
+ if (BackUpBuffer != NULL) {
+ FreePool (BackUpBuffer);
+ }
}
if (SubmitFormIsRequired && !SkipSaveOrDiscard) {
@@ -2399,6 +2430,8 @@
if (!EFI_ERROR (Status) && Statement->Operand != EFI_IFR_REF_OP) {
ProcessCallBackFunction(Selection, Statement,
EFI_BROWSER_ACTION_CHANGED, FALSE);
}
+ } else if (Statement->Operand != EFI_IFR_PASSWORD_OP) {
+ SetQuestionValue (gCurrentSelection->FormSet, gCurrentSelection->Form,
Statement, GetSetValueWithEditBuffer);
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits