diff options
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c | 23 | ||||
-rw-r--r-- | MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 12 |
2 files changed, 22 insertions, 13 deletions
diff --git a/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c b/MdeModulePkg/Universal/DriverSampleDxe/DriverSample.c index 74866be..38d36f8 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 15d4af3..4f2c92c 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;
}
|