summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/SetupBrowserDxe
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-23 09:41:33 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-06-23 09:41:33 +0000
commit813acf3a9a99e97ab200c7e222ee96810a9aa3fd (patch)
tree199eca9222be7d720c476bf30c7c17342a4c8b17 /MdeModulePkg/Universal/SetupBrowserDxe
parent54cf87805f9ad61a316ce9e4eb9c67154c87cf0b (diff)
downloadedk2-813acf3a9a99e97ab200c7e222ee96810a9aa3fd.zip
edk2-813acf3a9a99e97ab200c7e222ee96810a9aa3fd.tar.gz
edk2-813acf3a9a99e97ab200c7e222ee96810a9aa3fd.tar.bz2
Merged in the following trackers from EDK:
EDK1145 Cursor mising in shell in some case EDK1099: Dell - [HII] HiiGetFontInfo() not retrieve the system font by FoFontInfoMask EDK1127: [UEFI 2.10] Keyboard layout support EDK1129: [UEFI HII] GUID is represented wrongly in Config String And some other fixes such as *[UEFI HII] HiiGetAltCfg is generating "Name=" sub string in the wrong format *UEFI HII: GetUnicodeStringTextOrSize() doesn't handle NULL StringDest properly *GetFontInfo() need be updated to avoid iteration *HIIStringProtocolTest failed on multiple platform *[Uefi 2.1] Comply with latest Hii ECR * GetFontInfo() need be updated to avoid iteration git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5361 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/SetupBrowserDxe')
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c10
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Setup.c42
-rw-r--r--MdeModulePkg/Universal/SetupBrowserDxe/Ui.c2
3 files changed, 38 insertions, 16 deletions
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
index c813081..9108acb 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c
@@ -1,5 +1,5 @@
/** @file
-Copyright (c) 2007, Intel Corporation
+Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1233,11 +1233,11 @@ ParseOpCodes (
//
CurrentStatement->Minimum = ((EFI_IFR_STRING *) OpCodeData)->MinSize;
CurrentStatement->Maximum = ((EFI_IFR_STRING *) OpCodeData)->MaxSize;
- CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (UINT16));
+ CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (CHAR16));
CurrentStatement->Flags = ((EFI_IFR_STRING *) OpCodeData)->Flags;
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_STRING;
- CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth);
+ CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth + sizeof (CHAR16));
InitializeRequestElement (FormSet, CurrentStatement);
break;
@@ -1252,10 +1252,10 @@ ParseOpCodes (
//
CopyMem (&CurrentStatement->Minimum, &((EFI_IFR_PASSWORD *) OpCodeData)->MinSize, sizeof (UINT16));
CopyMem (&CurrentStatement->Maximum, &((EFI_IFR_PASSWORD *) OpCodeData)->MaxSize, sizeof (UINT16));
- CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (UINT16));
+ CurrentStatement->StorageWidth = (UINT16)((UINTN) CurrentStatement->Maximum * sizeof (CHAR16));
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_STRING;
- CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth);
+ CurrentStatement->BufferValue = AllocateZeroPool ((CurrentStatement->StorageWidth + sizeof (CHAR16)));
InitializeRequestElement (FormSet, CurrentStatement);
break;
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 8203531..ff85775 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -1,5 +1,5 @@
/** @file
-Copyright (c) 2007, Intel Corporation
+Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1173,7 +1173,11 @@ GetQuestionValue (
}
if (IsString) {
- StrCpy ((CHAR16 *) Dst, Value);
+ //
+ // Convert Config String to Unicode String, e.g "0041004200430044" => "ABCD"
+ //
+ Length = StorageWidth + sizeof (CHAR16);
+ Status = ConfigStringToUnicode ((CHAR16 *) Dst, &Length, Value);
} else {
Status = HexStringToBuf (Dst, &StorageWidth, Value, NULL);
}
@@ -1239,7 +1243,11 @@ GetQuestionValue (
//
Value = Value + 1;
if (!IsBufferStorage && IsString) {
- StrCpy ((CHAR16 *) Dst, Value);
+ //
+ // Convert Config String to Unicode String, e.g "0041004200430044" => "ABCD"
+ //
+ Length = StorageWidth + sizeof (CHAR16);
+ Status = ConfigStringToUnicode ((CHAR16 *) Dst, &Length, Value);
} else {
Status = HexStringToBuf (Dst, &StorageWidth, Value, NULL);
if (EFI_ERROR (Status)) {
@@ -1408,13 +1416,21 @@ SetQuestionValue (
CopyMem (Storage->EditBuffer + Question->VarStoreInfo.VarOffset, Src, StorageWidth);
} else {
if (IsString) {
+ //
+ // Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
+ //
Value = NULL;
- NewStringCpy (&Value, (CHAR16 *) Src);
- } else {
- BufferLen = (StorageWidth * 2 + 1) * sizeof (CHAR16);
+ BufferLen = ((StrLen ((CHAR16 *) Src) * 4) + 1) * sizeof (CHAR16);
Value = AllocateZeroPool (BufferLen);
ASSERT (Value != NULL);
+ Status = UnicodeToConfigString (Value, &BufferLen, (CHAR16 *) Src);
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ BufferLen = StorageWidth * 2 + 1;
+ Value = AllocateZeroPool (BufferLen * sizeof (CHAR16));
+ ASSERT (Value != NULL);
BufToHexString (Value, &BufferLen, Src, StorageWidth);
+ ToLower (Value);
}
Status = SetValueByName (Storage, Question->VariableName, Value);
@@ -1424,7 +1440,7 @@ SetQuestionValue (
if (!Cached) {
//
// <ConfigResp> ::= <ConfigHdr> + <BlockName> + "&VALUE=" + "<HexCh>StorageWidth * 2" ||
- // <ConfigHdr> + "&" + <VariableName> + "=" + "<HexCh>StorageWidth * 2"
+ // <ConfigHdr> + "&" + <VariableName> + "=" + "<string>"
//
if (IsBufferStorage) {
Length = StrLen (Question->BlockName) + 7;
@@ -1432,7 +1448,7 @@ SetQuestionValue (
Length = StrLen (Question->VariableName) + 2;
}
if (!IsBufferStorage && IsString) {
- Length += StrLen ((CHAR16 *) Src);
+ Length += (StrLen ((CHAR16 *) Src) * 4);
} else {
Length += (StorageWidth * 2);
}
@@ -1451,10 +1467,16 @@ SetQuestionValue (
Value = ConfigResp + StrLen (ConfigResp);
if (!IsBufferStorage && IsString) {
- StrCpy (Value, (CHAR16 *) Src);
+ //
+ // Convert Unicode String to Config String, e.g. "ABCD" => "0041004200430044"
+ //
+ BufferLen = ((StrLen ((CHAR16 *) Src) * 4) + 1) * sizeof (CHAR16);
+ Status = UnicodeToConfigString (Value, &BufferLen, (CHAR16 *) Src);
+ ASSERT_EFI_ERROR (Status);
} else {
- BufferLen = (StorageWidth * 2 + 1) * sizeof (CHAR16);
+ BufferLen = StorageWidth * 2 + 1;
BufToHexString (Value, &BufferLen, Src, StorageWidth);
+ ToLower (Value);
}
//
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
index 064a8d9..04b9f69 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Ui.c
@@ -2299,7 +2299,7 @@ UiDisplayMenu (
Selection->Statement = NULL;
break;
}
- BufferSize = StrLen (StringPtr) / 4;
+ BufferSize = StrLen (StringPtr) / 2;
DevicePath = AllocatePool (BufferSize);
HexStringToBuffer ((UINT8 *) DevicePath, &BufferSize, StringPtr);