MdeModulePkg: Replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr
It is the follow up of 3ab41b7a32
to replace UnicodeStrToAsciiStr/AsciiStrToUnicodeStr with
UnicodeStrToAsciiStrS/AsciiStrToUnicodeStrS.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
@ -483,7 +483,7 @@ GetOptionalStringByIndex (
|
|||||||
*String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
|
*String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));
|
||||||
} else {
|
} else {
|
||||||
*String = AllocatePool (StrSize * sizeof (CHAR16));
|
*String = AllocatePool (StrSize * sizeof (CHAR16));
|
||||||
AsciiStrToUnicodeStr (OptionalStrStart, *String);
|
AsciiStrToUnicodeStrS (OptionalStrStart, *String, StrSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -259,6 +259,7 @@ UiCreateLanguageMenu (
|
|||||||
{
|
{
|
||||||
CHAR8 *LangCode;
|
CHAR8 *LangCode;
|
||||||
CHAR8 *Lang;
|
CHAR8 *Lang;
|
||||||
|
UINTN LangSize;
|
||||||
CHAR8 *CurrentLang;
|
CHAR8 *CurrentLang;
|
||||||
UINTN OptionCount;
|
UINTN OptionCount;
|
||||||
CHAR16 *StringBuffer;
|
CHAR16 *StringBuffer;
|
||||||
@ -328,9 +329,10 @@ UiCreateLanguageMenu (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16));
|
LangSize = AsciiStrSize (Lang);
|
||||||
|
StringBuffer = AllocatePool (LangSize * sizeof (CHAR16));
|
||||||
ASSERT (StringBuffer != NULL);
|
ASSERT (StringBuffer != NULL);
|
||||||
AsciiStrToUnicodeStr (Lang, StringBuffer);
|
AsciiStrToUnicodeStrS (Lang, StringBuffer, LangSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (StringBuffer != NULL);
|
ASSERT (StringBuffer != NULL);
|
||||||
|
@ -231,7 +231,7 @@ GetEmmcModelName (
|
|||||||
String[sizeof (Cid->OemId) + sizeof (Cid->ProductName)] = ' ';
|
String[sizeof (Cid->OemId) + sizeof (Cid->ProductName)] = ' ';
|
||||||
CopyMem (String + sizeof (Cid->OemId) + sizeof (Cid->ProductName) + 1, Cid->ProductSerialNumber, sizeof (Cid->ProductSerialNumber));
|
CopyMem (String + sizeof (Cid->OemId) + sizeof (Cid->ProductName) + 1, Cid->ProductSerialNumber, sizeof (Cid->ProductSerialNumber));
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (String, Device->ModelName);
|
AsciiStrToUnicodeStrS (String, Device->ModelName, sizeof (Device->ModelName) / sizeof (Device->ModelName[0]));
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ GetSdModelName (
|
|||||||
String[sizeof (Cid->OemId) + sizeof (Cid->ProductName)] = ' ';
|
String[sizeof (Cid->OemId) + sizeof (Cid->ProductName)] = ' ';
|
||||||
CopyMem (String + sizeof (Cid->OemId) + sizeof (Cid->ProductName) + 1, Cid->ProductSerialNumber, sizeof (Cid->ProductSerialNumber));
|
CopyMem (String + sizeof (Cid->OemId) + sizeof (Cid->ProductName) + 1, Cid->ProductSerialNumber, sizeof (Cid->ProductSerialNumber));
|
||||||
|
|
||||||
AsciiStrToUnicodeStr (String, Device->ModelName);
|
AsciiStrToUnicodeStrS (String, Device->ModelName, sizeof (Device->ModelName) / sizeof (Device->ModelName[0]));
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -2976,18 +2976,20 @@ NetLibStrToIp4 (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR8 *Ip4Str;
|
CHAR8 *Ip4Str;
|
||||||
|
UINTN StringSize;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if ((String == NULL) || (Ip4Address == NULL)) {
|
if ((String == NULL) || (Ip4Address == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ip4Str = (CHAR8 *) AllocatePool ((StrLen (String) + 1) * sizeof (CHAR8));
|
StringSize = StrLen (String) + 1;
|
||||||
|
Ip4Str = (CHAR8 *) AllocatePool (StringSize * sizeof (CHAR8));
|
||||||
if (Ip4Str == NULL) {
|
if (Ip4Str == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStr (String, Ip4Str);
|
UnicodeStrToAsciiStrS (String, Ip4Str, StringSize);
|
||||||
|
|
||||||
Status = NetLibAsciiStrToIp4 (Ip4Str, Ip4Address);
|
Status = NetLibAsciiStrToIp4 (Ip4Str, Ip4Address);
|
||||||
|
|
||||||
@ -3017,18 +3019,20 @@ NetLibStrToIp6 (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR8 *Ip6Str;
|
CHAR8 *Ip6Str;
|
||||||
|
UINTN StringSize;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
if ((String == NULL) || (Ip6Address == NULL)) {
|
if ((String == NULL) || (Ip6Address == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ip6Str = (CHAR8 *) AllocatePool ((StrLen (String) + 1) * sizeof (CHAR8));
|
StringSize = StrLen (String) + 1;
|
||||||
|
Ip6Str = (CHAR8 *) AllocatePool (StringSize * sizeof (CHAR8));
|
||||||
if (Ip6Str == NULL) {
|
if (Ip6Str == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStr (String, Ip6Str);
|
UnicodeStrToAsciiStrS (String, Ip6Str, StringSize);
|
||||||
|
|
||||||
Status = NetLibAsciiStrToIp6 (Ip6Str, Ip6Address);
|
Status = NetLibAsciiStrToIp6 (Ip6Str, Ip6Address);
|
||||||
|
|
||||||
@ -3060,6 +3064,7 @@ NetLibStrToIp6andPrefix (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR8 *Ip6Str;
|
CHAR8 *Ip6Str;
|
||||||
|
UINTN StringSize;
|
||||||
CHAR8 *PrefixStr;
|
CHAR8 *PrefixStr;
|
||||||
CHAR8 *TempStr;
|
CHAR8 *TempStr;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@ -3069,12 +3074,13 @@ NetLibStrToIp6andPrefix (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ip6Str = (CHAR8 *) AllocatePool ((StrLen (String) + 1) * sizeof (CHAR8));
|
StringSize = StrLen (String) + 1;
|
||||||
|
Ip6Str = (CHAR8 *) AllocatePool (StringSize * sizeof (CHAR8));
|
||||||
if (Ip6Str == NULL) {
|
if (Ip6Str == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
UnicodeStrToAsciiStr (String, Ip6Str);
|
UnicodeStrToAsciiStrS (String, Ip6Str, StringSize);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the sub string describing prefix length.
|
// Get the sub string describing prefix length.
|
||||||
|
@ -215,7 +215,7 @@ BmGetDescriptionFromDiskInfo (
|
|||||||
StrPtr = (CHAR8 *) (&InquiryData.Reserved_5_95[VENDOR_IDENTIFICATION_OFFSET]);
|
StrPtr = (CHAR8 *) (&InquiryData.Reserved_5_95[VENDOR_IDENTIFICATION_OFFSET]);
|
||||||
Temp = StrPtr[VENDOR_IDENTIFICATION_LENGTH];
|
Temp = StrPtr[VENDOR_IDENTIFICATION_LENGTH];
|
||||||
StrPtr[VENDOR_IDENTIFICATION_LENGTH] = '\0';
|
StrPtr[VENDOR_IDENTIFICATION_LENGTH] = '\0';
|
||||||
AsciiStrToUnicodeStr (StrPtr, Description);
|
AsciiStrToUnicodeStrS (StrPtr, Description, VENDOR_IDENTIFICATION_LENGTH + 1);
|
||||||
StrPtr[VENDOR_IDENTIFICATION_LENGTH] = Temp;
|
StrPtr[VENDOR_IDENTIFICATION_LENGTH] = Temp;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -225,7 +225,7 @@ BmGetDescriptionFromDiskInfo (
|
|||||||
|
|
||||||
StrPtr = (CHAR8 *) (&InquiryData.Reserved_5_95[PRODUCT_IDENTIFICATION_OFFSET]);
|
StrPtr = (CHAR8 *) (&InquiryData.Reserved_5_95[PRODUCT_IDENTIFICATION_OFFSET]);
|
||||||
StrPtr[PRODUCT_IDENTIFICATION_LENGTH] = '\0';
|
StrPtr[PRODUCT_IDENTIFICATION_LENGTH] = '\0';
|
||||||
AsciiStrToUnicodeStr (StrPtr, Description + VENDOR_IDENTIFICATION_LENGTH + 1);
|
AsciiStrToUnicodeStrS (StrPtr, Description + VENDOR_IDENTIFICATION_LENGTH + 1, PRODUCT_IDENTIFICATION_LENGTH + 1);
|
||||||
|
|
||||||
BmEliminateExtraSpaces (Description);
|
BmEliminateExtraSpaces (Description);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Var Check Hii bin generation.
|
Var Check Hii bin generation.
|
||||||
|
|
||||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -1130,13 +1130,13 @@ CreateHiiVariableNode (
|
|||||||
//
|
//
|
||||||
// Get variable name.
|
// Get variable name.
|
||||||
//
|
//
|
||||||
VarNameSize = AsciiStrSize ((CHAR8 *) IfrEfiVarStore->Name) * 2;
|
VarNameSize = AsciiStrSize ((CHAR8 *) IfrEfiVarStore->Name) * sizeof (CHAR16);
|
||||||
if (VarNameSize > mMaxVarNameSize) {
|
if (VarNameSize > mMaxVarNameSize) {
|
||||||
mVarName = InternalVarCheckReallocatePool (mMaxVarNameSize, VarNameSize, mVarName);
|
mVarName = InternalVarCheckReallocatePool (mMaxVarNameSize, VarNameSize, mVarName);
|
||||||
ASSERT (mVarName != NULL);
|
ASSERT (mVarName != NULL);
|
||||||
mMaxVarNameSize = VarNameSize;
|
mMaxVarNameSize = VarNameSize;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *) IfrEfiVarStore->Name, mVarName);
|
AsciiStrToUnicodeStrS ((CHAR8 *) IfrEfiVarStore->Name, mVarName, mMaxVarNameSize / sizeof (CHAR16));
|
||||||
VarName = mVarName;
|
VarName = mVarName;
|
||||||
|
|
||||||
HiiVariableNode = FindHiiVariableNode (
|
HiiVariableNode = FindHiiVariableNode (
|
||||||
|
@ -178,6 +178,7 @@ ExtractNameSpace (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR16 *TmpPtr;
|
CHAR16 *TmpPtr;
|
||||||
|
UINTN NameSpaceSize;
|
||||||
|
|
||||||
ASSERT (NameSpace != NULL);
|
ASSERT (NameSpace != NULL);
|
||||||
|
|
||||||
@ -218,11 +219,12 @@ ExtractNameSpace (
|
|||||||
// Input NameSpace is unicode string. The language in String package is ascii string.
|
// Input NameSpace is unicode string. The language in String package is ascii string.
|
||||||
// Here will convert the unicode string to ascii and save it.
|
// Here will convert the unicode string to ascii and save it.
|
||||||
//
|
//
|
||||||
*NameSpace = AllocatePool (StrLen (String) + 1);
|
NameSpaceSize = StrLen (String) + 1;
|
||||||
|
*NameSpace = AllocatePool (NameSpaceSize);
|
||||||
if (*NameSpace == NULL) {
|
if (*NameSpace == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
UnicodeStrToAsciiStr (String, *NameSpace);
|
UnicodeStrToAsciiStrS (String, *NameSpace, NameSpaceSize);
|
||||||
|
|
||||||
if (TmpPtr != NULL) {
|
if (TmpPtr != NULL) {
|
||||||
*TmpPtr = L'&';
|
*TmpPtr = L'&';
|
||||||
@ -779,6 +781,7 @@ GetStringIdFromString (
|
|||||||
UINTN StringSize;
|
UINTN StringSize;
|
||||||
CHAR16 *String;
|
CHAR16 *String;
|
||||||
CHAR8 *AsciiKeywordValue;
|
CHAR8 *AsciiKeywordValue;
|
||||||
|
UINTN KeywordValueSize;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
ASSERT (StringPackage != NULL && KeywordValue != NULL && StringId != NULL);
|
ASSERT (StringPackage != NULL && KeywordValue != NULL && StringId != NULL);
|
||||||
@ -794,11 +797,12 @@ GetStringIdFromString (
|
|||||||
//
|
//
|
||||||
// Make a ascii keyword value for later use.
|
// Make a ascii keyword value for later use.
|
||||||
//
|
//
|
||||||
AsciiKeywordValue = AllocatePool (StrLen (KeywordValue) + 1);
|
KeywordValueSize = StrLen (KeywordValue) + 1;
|
||||||
|
AsciiKeywordValue = AllocatePool (KeywordValueSize);
|
||||||
if (AsciiKeywordValue == NULL) {
|
if (AsciiKeywordValue == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
UnicodeStrToAsciiStr(KeywordValue, AsciiKeywordValue);
|
UnicodeStrToAsciiStrS (KeywordValue, AsciiKeywordValue, KeywordValueSize);
|
||||||
|
|
||||||
while (*BlockHdr != EFI_HII_SIBT_END) {
|
while (*BlockHdr != EFI_HII_SIBT_END) {
|
||||||
switch (*BlockHdr) {
|
switch (*BlockHdr) {
|
||||||
@ -1065,11 +1069,12 @@ GetNextStringId (
|
|||||||
StringTextPtr = BlockHdr + Offset;
|
StringTextPtr = BlockHdr + Offset;
|
||||||
|
|
||||||
if (FindString) {
|
if (FindString) {
|
||||||
*KeywordValue = AllocatePool (AsciiStrSize ((CHAR8 *) StringTextPtr) * sizeof (CHAR16));
|
StringSize = AsciiStrSize ((CHAR8 *) StringTextPtr);
|
||||||
|
*KeywordValue = AllocatePool (StringSize * sizeof (CHAR16));
|
||||||
if (*KeywordValue == NULL) {
|
if (*KeywordValue == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *) StringTextPtr, *KeywordValue);
|
AsciiStrToUnicodeStrS ((CHAR8 *) StringTextPtr, *KeywordValue, StringSize);
|
||||||
return CurrentStringId;
|
return CurrentStringId;
|
||||||
} else if (CurrentStringId == StringId) {
|
} else if (CurrentStringId == StringId) {
|
||||||
FindString = TRUE;
|
FindString = TRUE;
|
||||||
@ -1084,11 +1089,12 @@ GetNextStringId (
|
|||||||
StringTextPtr = BlockHdr + Offset;
|
StringTextPtr = BlockHdr + Offset;
|
||||||
|
|
||||||
if (FindString) {
|
if (FindString) {
|
||||||
*KeywordValue = AllocatePool (AsciiStrSize ((CHAR8 *) StringTextPtr) * sizeof (CHAR16));
|
StringSize = AsciiStrSize ((CHAR8 *) StringTextPtr);
|
||||||
|
*KeywordValue = AllocatePool (StringSize * sizeof (CHAR16));
|
||||||
if (*KeywordValue == NULL) {
|
if (*KeywordValue == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *) StringTextPtr, *KeywordValue);
|
AsciiStrToUnicodeStrS ((CHAR8 *) StringTextPtr, *KeywordValue, StringSize);
|
||||||
return CurrentStringId;
|
return CurrentStringId;
|
||||||
} else if (CurrentStringId == StringId) {
|
} else if (CurrentStringId == StringId) {
|
||||||
FindString = TRUE;
|
FindString = TRUE;
|
||||||
@ -1105,11 +1111,12 @@ GetNextStringId (
|
|||||||
|
|
||||||
for (Index = 0; Index < StringCount; Index++) {
|
for (Index = 0; Index < StringCount; Index++) {
|
||||||
if (FindString) {
|
if (FindString) {
|
||||||
*KeywordValue = AllocatePool (AsciiStrSize ((CHAR8 *) StringTextPtr) * sizeof (CHAR16));
|
StringSize = AsciiStrSize ((CHAR8 *) StringTextPtr);
|
||||||
|
*KeywordValue = AllocatePool (StringSize * sizeof (CHAR16));
|
||||||
if (*KeywordValue == NULL) {
|
if (*KeywordValue == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *) StringTextPtr, *KeywordValue);
|
AsciiStrToUnicodeStrS ((CHAR8 *) StringTextPtr, *KeywordValue, StringSize);
|
||||||
return CurrentStringId;
|
return CurrentStringId;
|
||||||
} else if (CurrentStringId == StringId) {
|
} else if (CurrentStringId == StringId) {
|
||||||
FindString = TRUE;
|
FindString = TRUE;
|
||||||
@ -1132,11 +1139,12 @@ GetNextStringId (
|
|||||||
|
|
||||||
for (Index = 0; Index < StringCount; Index++) {
|
for (Index = 0; Index < StringCount; Index++) {
|
||||||
if (FindString) {
|
if (FindString) {
|
||||||
*KeywordValue = AllocatePool (AsciiStrSize ((CHAR8 *) StringTextPtr) * sizeof (CHAR16));
|
StringSize = AsciiStrSize ((CHAR8 *) StringTextPtr);
|
||||||
|
*KeywordValue = AllocatePool (StringSize * sizeof (CHAR16));
|
||||||
if (*KeywordValue == NULL) {
|
if (*KeywordValue == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *) StringTextPtr, *KeywordValue);
|
AsciiStrToUnicodeStrS ((CHAR8 *) StringTextPtr, *KeywordValue, StringSize);
|
||||||
return CurrentStringId;
|
return CurrentStringId;
|
||||||
} else if (CurrentStringId == StringId) {
|
} else if (CurrentStringId == StringId) {
|
||||||
FindString = TRUE;
|
FindString = TRUE;
|
||||||
@ -1670,6 +1678,7 @@ ConstructConfigHdr (
|
|||||||
UINT8 *Buffer;
|
UINT8 *Buffer;
|
||||||
CHAR16 *Name;
|
CHAR16 *Name;
|
||||||
CHAR8 *AsciiName;
|
CHAR8 *AsciiName;
|
||||||
|
UINTN NameSize;
|
||||||
EFI_GUID *Guid;
|
EFI_GUID *Guid;
|
||||||
UINTN MaxLen;
|
UINTN MaxLen;
|
||||||
|
|
||||||
@ -1699,9 +1708,10 @@ ConstructConfigHdr (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (AsciiName != NULL) {
|
if (AsciiName != NULL) {
|
||||||
Name = AllocateZeroPool (AsciiStrSize (AsciiName) * 2);
|
NameSize = AsciiStrSize (AsciiName);
|
||||||
|
Name = AllocateZeroPool (NameSize * sizeof (CHAR16));
|
||||||
ASSERT (Name != NULL);
|
ASSERT (Name != NULL);
|
||||||
AsciiStrToUnicodeStr(AsciiName, Name);
|
AsciiStrToUnicodeStrS (AsciiName, Name, NameSize);
|
||||||
} else {
|
} else {
|
||||||
Name = NULL;
|
Name = NULL;
|
||||||
}
|
}
|
||||||
@ -2375,6 +2385,7 @@ GenerateKeywordResp (
|
|||||||
CHAR16 *RespStr;
|
CHAR16 *RespStr;
|
||||||
CHAR16 *PathHdr;
|
CHAR16 *PathHdr;
|
||||||
CHAR16 *UnicodeNameSpace;
|
CHAR16 *UnicodeNameSpace;
|
||||||
|
UINTN NameSpaceLength;
|
||||||
|
|
||||||
ASSERT ((NameSpace != NULL) && (DevicePath != NULL) && (KeywordData != NULL) && (ValueStr != NULL) && (KeywordResp != NULL));
|
ASSERT ((NameSpace != NULL) && (DevicePath != NULL) && (KeywordData != NULL) && (ValueStr != NULL) && (KeywordResp != NULL));
|
||||||
|
|
||||||
@ -2385,12 +2396,13 @@ GenerateKeywordResp (
|
|||||||
// 1.1 NameSpaceId size.
|
// 1.1 NameSpaceId size.
|
||||||
// 'NAMESPACE='<String>
|
// 'NAMESPACE='<String>
|
||||||
//
|
//
|
||||||
RespStrLen = 10 + AsciiStrLen (NameSpace);
|
NameSpaceLength = AsciiStrLen (NameSpace);
|
||||||
UnicodeNameSpace = AllocatePool ((AsciiStrLen (NameSpace) + 1) * sizeof (CHAR16));
|
RespStrLen = 10 + NameSpaceLength;
|
||||||
|
UnicodeNameSpace = AllocatePool ((NameSpaceLength + 1) * sizeof (CHAR16));
|
||||||
if (UnicodeNameSpace == NULL) {
|
if (UnicodeNameSpace == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr(NameSpace, UnicodeNameSpace);
|
AsciiStrToUnicodeStrS (NameSpace, UnicodeNameSpace, NameSpaceLength + 1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// 1.2 PathHdr size.
|
// 1.2 PathHdr size.
|
||||||
|
@ -1604,6 +1604,7 @@ GetVarStoreType (
|
|||||||
UINTN PackageOffset;
|
UINTN PackageOffset;
|
||||||
EFI_IFR_OP_HEADER *IfrOpHdr;
|
EFI_IFR_OP_HEADER *IfrOpHdr;
|
||||||
CHAR16 *VarStoreName;
|
CHAR16 *VarStoreName;
|
||||||
|
UINTN NameSize;
|
||||||
EFI_STRING GuidStr;
|
EFI_STRING GuidStr;
|
||||||
EFI_STRING NameStr;
|
EFI_STRING NameStr;
|
||||||
EFI_STRING TempStr;
|
EFI_STRING TempStr;
|
||||||
@ -1658,12 +1659,13 @@ GetVarStoreType (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name) * sizeof (CHAR16));
|
NameSize = AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name);
|
||||||
|
VarStoreName = AllocateZeroPool (NameSize * sizeof (CHAR16));
|
||||||
if (VarStoreName == NULL) {
|
if (VarStoreName == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *) IfrEfiVarStore->Name, VarStoreName);
|
AsciiStrToUnicodeStrS ((CHAR8 *) IfrEfiVarStore->Name, VarStoreName, NameSize);
|
||||||
|
|
||||||
GenerateSubStr (L"GUID=", sizeof (EFI_GUID), (VOID *) &IfrEfiVarStore->Guid, 1, &GuidStr);
|
GenerateSubStr (L"GUID=", sizeof (EFI_GUID), (VOID *) &IfrEfiVarStore->Guid, 1, &GuidStr);
|
||||||
GenerateSubStr (L"NAME=", StrLen (VarStoreName) * sizeof (CHAR16), (VOID *) VarStoreName, 2, &NameStr);
|
GenerateSubStr (L"NAME=", StrLen (VarStoreName) * sizeof (CHAR16), (VOID *) VarStoreName, 2, &NameStr);
|
||||||
@ -1836,6 +1838,7 @@ IsThisPackageList (
|
|||||||
UINTN PackageOffset;
|
UINTN PackageOffset;
|
||||||
EFI_IFR_OP_HEADER *IfrOpHdr;
|
EFI_IFR_OP_HEADER *IfrOpHdr;
|
||||||
CHAR16 *VarStoreName;
|
CHAR16 *VarStoreName;
|
||||||
|
UINTN NameSize;
|
||||||
UINT8 *HiiFormPackage;
|
UINT8 *HiiFormPackage;
|
||||||
UINTN PackageSize;
|
UINTN PackageSize;
|
||||||
EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
|
EFI_IFR_VARSTORE_EFI *IfrEfiVarStore;
|
||||||
@ -1880,11 +1883,12 @@ IsThisPackageList (
|
|||||||
case EFI_IFR_VARSTORE_OP:
|
case EFI_IFR_VARSTORE_OP:
|
||||||
IfrVarStore = (EFI_IFR_VARSTORE *) IfrOpHdr;
|
IfrVarStore = (EFI_IFR_VARSTORE *) IfrOpHdr;
|
||||||
|
|
||||||
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)IfrVarStore->Name) * sizeof (CHAR16));
|
NameSize = AsciiStrSize ((CHAR8 *)IfrVarStore->Name);
|
||||||
|
VarStoreName = AllocateZeroPool (NameSize * sizeof (CHAR16));
|
||||||
if (VarStoreName == NULL) {
|
if (VarStoreName == NULL) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *)IfrVarStore->Name, VarStoreName);
|
AsciiStrToUnicodeStrS ((CHAR8 *)IfrVarStore->Name, VarStoreName, NameSize);
|
||||||
|
|
||||||
if (IsThisVarstore((VOID *)&IfrVarStore->Guid, VarStoreName, ConfigHdr)) {
|
if (IsThisVarstore((VOID *)&IfrVarStore->Guid, VarStoreName, ConfigHdr)) {
|
||||||
FindVarstore = TRUE;
|
FindVarstore = TRUE;
|
||||||
@ -1897,11 +1901,12 @@ IsThisPackageList (
|
|||||||
|
|
||||||
case EFI_IFR_VARSTORE_EFI_OP:
|
case EFI_IFR_VARSTORE_EFI_OP:
|
||||||
IfrEfiVarStore = (EFI_IFR_VARSTORE_EFI *) IfrOpHdr;
|
IfrEfiVarStore = (EFI_IFR_VARSTORE_EFI *) IfrOpHdr;
|
||||||
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name) * sizeof (CHAR16));
|
NameSize = AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name);
|
||||||
|
VarStoreName = AllocateZeroPool (NameSize * sizeof (CHAR16));
|
||||||
if (VarStoreName == NULL) {
|
if (VarStoreName == NULL) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *)IfrEfiVarStore->Name, VarStoreName);
|
AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name, VarStoreName, NameSize);
|
||||||
|
|
||||||
if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName, ConfigHdr)) {
|
if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName, ConfigHdr)) {
|
||||||
FindVarstore = TRUE;
|
FindVarstore = TRUE;
|
||||||
@ -2086,6 +2091,7 @@ ParseIfrData (
|
|||||||
IFR_DEFAULT_DATA *DefaultDataPtr;
|
IFR_DEFAULT_DATA *DefaultDataPtr;
|
||||||
IFR_BLOCK_DATA *BlockData;
|
IFR_BLOCK_DATA *BlockData;
|
||||||
CHAR16 *VarStoreName;
|
CHAR16 *VarStoreName;
|
||||||
|
UINTN NameSize;
|
||||||
UINT16 VarWidth;
|
UINT16 VarWidth;
|
||||||
UINT16 VarDefaultId;
|
UINT16 VarDefaultId;
|
||||||
BOOLEAN FirstOneOfOption;
|
BOOLEAN FirstOneOfOption;
|
||||||
@ -2144,12 +2150,13 @@ ParseIfrData (
|
|||||||
|
|
||||||
IfrVarStore = (EFI_IFR_VARSTORE *) IfrOpHdr;
|
IfrVarStore = (EFI_IFR_VARSTORE *) IfrOpHdr;
|
||||||
|
|
||||||
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)IfrVarStore->Name) * sizeof (CHAR16));
|
NameSize = AsciiStrSize ((CHAR8 *)IfrVarStore->Name);
|
||||||
|
VarStoreName = AllocateZeroPool (NameSize * sizeof (CHAR16));
|
||||||
if (VarStoreName == NULL) {
|
if (VarStoreName == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *)IfrVarStore->Name, VarStoreName);
|
AsciiStrToUnicodeStrS ((CHAR8 *)IfrVarStore->Name, VarStoreName, NameSize);
|
||||||
|
|
||||||
if (IsThisVarstore((VOID *)&IfrVarStore->Guid, VarStoreName, ConfigHdr)) {
|
if (IsThisVarstore((VOID *)&IfrVarStore->Guid, VarStoreName, ConfigHdr)) {
|
||||||
//
|
//
|
||||||
@ -2185,12 +2192,13 @@ ParseIfrData (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name) * sizeof (CHAR16));
|
NameSize = AsciiStrSize ((CHAR8 *)IfrEfiVarStore->Name);
|
||||||
|
VarStoreName = AllocateZeroPool (NameSize * sizeof (CHAR16));
|
||||||
if (VarStoreName == NULL) {
|
if (VarStoreName == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *)IfrEfiVarStore->Name, VarStoreName);
|
AsciiStrToUnicodeStrS ((CHAR8 *)IfrEfiVarStore->Name, VarStoreName, NameSize);
|
||||||
|
|
||||||
if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName, ConfigHdr)) {
|
if (IsThisVarstore (&IfrEfiVarStore->Guid, VarStoreName, ConfigHdr)) {
|
||||||
//
|
//
|
||||||
@ -3966,6 +3974,7 @@ GetConfigRespFromEfiVarStore (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_STRING VarStoreName;
|
EFI_STRING VarStoreName;
|
||||||
|
UINTN NameSize;
|
||||||
UINT8 *VarStore;
|
UINT8 *VarStore;
|
||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
|
|
||||||
@ -3974,13 +3983,14 @@ GetConfigRespFromEfiVarStore (
|
|||||||
VarStore = NULL;
|
VarStore = NULL;
|
||||||
VarStoreName = NULL;
|
VarStoreName = NULL;
|
||||||
*AccessProgress = Request;
|
*AccessProgress = Request;
|
||||||
|
|
||||||
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)EfiVarStoreInfo->Name) * sizeof (CHAR16));
|
NameSize = AsciiStrSize ((CHAR8 *)EfiVarStoreInfo->Name);
|
||||||
|
VarStoreName = AllocateZeroPool (NameSize * sizeof (CHAR16));
|
||||||
if (VarStoreName == NULL) {
|
if (VarStoreName == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *) EfiVarStoreInfo->Name, VarStoreName);
|
AsciiStrToUnicodeStrS ((CHAR8 *) EfiVarStoreInfo->Name, VarStoreName, NameSize);
|
||||||
|
|
||||||
|
|
||||||
Status = gRT->GetVariable (VarStoreName, &EfiVarStoreInfo->Guid, NULL, &BufferSize, NULL);
|
Status = gRT->GetVariable (VarStoreName, &EfiVarStoreInfo->Guid, NULL, &BufferSize, NULL);
|
||||||
@ -4041,6 +4051,7 @@ RouteConfigRespForEfiVarStore (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_STRING VarStoreName;
|
EFI_STRING VarStoreName;
|
||||||
|
UINTN NameSize;
|
||||||
UINT8 *VarStore;
|
UINT8 *VarStore;
|
||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
UINTN BlockSize;
|
UINTN BlockSize;
|
||||||
@ -4050,12 +4061,13 @@ RouteConfigRespForEfiVarStore (
|
|||||||
VarStore = NULL;
|
VarStore = NULL;
|
||||||
VarStoreName = NULL;
|
VarStoreName = NULL;
|
||||||
|
|
||||||
VarStoreName = AllocateZeroPool (AsciiStrSize ((CHAR8 *)EfiVarStoreInfo->Name) * sizeof (CHAR16));
|
NameSize = AsciiStrSize ((CHAR8 *)EfiVarStoreInfo->Name);
|
||||||
|
VarStoreName = AllocateZeroPool (NameSize * sizeof (CHAR16));
|
||||||
if (VarStoreName == NULL) {
|
if (VarStoreName == NULL) {
|
||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
AsciiStrToUnicodeStr ((CHAR8 *) EfiVarStoreInfo->Name, VarStoreName);
|
AsciiStrToUnicodeStrS ((CHAR8 *) EfiVarStoreInfo->Name, VarStoreName, NameSize);
|
||||||
|
|
||||||
Status = gRT->GetVariable (VarStoreName, &EfiVarStoreInfo->Guid, NULL, &BufferSize, NULL);
|
Status = gRT->GetVariable (VarStoreName, &EfiVarStoreInfo->Guid, NULL, &BufferSize, NULL);
|
||||||
if (Status != EFI_BUFFER_TOO_SMALL) {
|
if (Status != EFI_BUFFER_TOO_SMALL) {
|
||||||
|
Reference in New Issue
Block a user