summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-25 09:08:30 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-25 09:08:30 +0000
commit086cd2c8e932297641aba4986e3376b202365b5a (patch)
tree7e91f16fb20746c2ad19afefe051e72dfa9e6c26
parentcab302fd4cb652cd05d2d0ff1629fda07d4e330c (diff)
downloadedk2-platforms-086cd2c8e932297641aba4986e3376b202365b5a.tar.xz
Correct DriverSample ConfigAcess protocol ExtractConfig interface.
Correct SetupBrowser to set default value for default sting ID. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8660 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c23
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c12
2 files changed, 22 insertions, 13 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
index 74866be7a9..38d36f8a28 100644
--- a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
+++ b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c
@@ -22,11 +22,6 @@ EFI_GUID mFormSetGuid = FORMSET_GUID;
EFI_GUID mInventoryGuid = INVENTORY_GUID;
CHAR16 VariableName[] = L"MyIfrNVData";
-//
-// <ConfigHdr> Template
-//
-CONST CHAR16 mDriverSampleConfigHdr[] = L"GUID=00000000000000000000000000000000&NAME=0000&PATH=00";
-
EFI_HANDLE DriverHandle[2] = {NULL, NULL};
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData = NULL;
@@ -347,17 +342,19 @@ ExtractConfig (
DRIVER_SAMPLE_PRIVATE_DATA *PrivateData;
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
EFI_STRING ConfigRequest;
+ EFI_STRING ConfigRequestHdr;
UINTN Size;
- if (Progress == NULL || Results == NULL) {
+ if (Progress == NULL || Results == NULL || Request == NULL) {
return EFI_INVALID_PARAMETER;
}
//
// Initialize the local variables.
//
- ConfigRequest = NULL;
- Size = 0;
- *Progress = Request;
+ ConfigRequestHdr = NULL;
+ ConfigRequest = NULL;
+ Size = 0;
+ *Progress = Request;
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
HiiConfigRouting = PrivateData->HiiConfigRouting;
@@ -387,9 +384,11 @@ ExtractConfig (
// Allocate and fill a buffer large enough to hold the <ConfigHdr> template
// followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
//
- Size = (StrLen (mDriverSampleConfigHdr) + 32 + 1) * sizeof (CHAR16);
+ ConfigRequestHdr = HiiConstructConfigHdr (&mFormSetGuid, VariableName, PrivateData->DriverHandle[0]);
+ Size = (StrLen (ConfigRequest) + 32 + 1) * sizeof (CHAR16);
ConfigRequest = AllocateZeroPool (Size);
- UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", mDriverSampleConfigHdr, (UINT64)BufferSize);
+ UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
+ FreePool (ConfigRequestHdr);
} else {
//
// Check routing data in <ConfigHdr>.
@@ -822,7 +821,7 @@ DriverSampleInit (
DRIVER_SAMPLE_CONFIGURATION *Configuration;
BOOLEAN ActionFlag;
EFI_STRING ConfigRequestHdr;
-
+
//
// Initialize the local variables.
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 15d4af3cf1..4f2c92c818 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -1779,8 +1779,10 @@ GetQuestionDefault (
QUESTION_OPTION *Option;
EFI_HII_VALUE *HiiValue;
UINT8 Index;
+ EFI_STRING StrValue;
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
+ StrValue = NULL;
//
// Statement don't have storage, skip them
@@ -1823,6 +1825,14 @@ GetQuestionDefault (
CopyMem (HiiValue, &Default->Value, sizeof (EFI_HII_VALUE));
}
+ if (HiiValue->Type == EFI_IFR_TYPE_STRING) {
+ StrValue = HiiGetString (FormSet->HiiHandle, HiiValue->Value.string, NULL);
+ if (StrValue == NULL) {
+ return EFI_NOT_FOUND;
+ }
+ Question->BufferValue = AllocateCopyPool (StrSize (StrValue), StrValue);
+ }
+
return EFI_SUCCESS;
}