VfrUtilityLib.cpp revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/** @file
Vfr common library functions.
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "stdio.h"
#include "stdlib.h"
#include "VfrUtilityLib.h"
#include "VfrFormPkg.h"
)
{
return;
}
}
}
}
)
{
return;
}
}
}
}
}
)
{
return;
}
switch (Type) {
case EFI_IFR_TYPE_NUM_SIZE_8 :
break;
case EFI_IFR_TYPE_NUM_SIZE_16 :
break;
case EFI_IFR_TYPE_NUM_SIZE_32 :
break;
case EFI_IFR_TYPE_NUM_SIZE_64 :
break;
case EFI_IFR_TYPE_BOOLEAN :
break;
case EFI_IFR_TYPE_TIME :
break;
case EFI_IFR_TYPE_DATE :
break;
case EFI_IFR_TYPE_STRING :
break;
case EFI_IFR_TYPE_OTHER :
return;
}
}
)
{
}
)
{
mId = 0;
mInfoStrList = NULL;
}
}
}
}
}
)
{
mInfoStrList = NULL;
}
}
}
}
}
)
{
while (mInfoStrList != NULL) {
Info = mInfoStrList;
}
}
)
{
return 1;
}
return 2;
}
if (mItemListHead == NULL) {
} else {
}
mItemListPos = pNew;
return 0;
}
)
{
}
)
{
}
)
{
SConfigItem *p;
return 0;
} else {
continue;
}
continue;
}
continue;
}
mItemListPos = p;
return 0;
}
}
return 1;
}
)
{
return Ret;
}
switch (Mode) {
case 'a' : // add
return 2;
}
if (mItemListHead == NULL) {
} else {
}
} else {
// tranverse the list to find out if there's already the value for the same offset
// check if the value and width are the same; return error if not
}
return 0;
}
}
return 2;
}
}
break;
case 'd' : // delete
if (mItemListHead == mItemListPos) {
delete mItemListPos;
break;
}
;
if (mItemListTail == mItemListPos) {
}
delete mItemListPos;
break;
case 'i' : // set info
delete mItemListPos->mId;
}
return 2;
}
}
break;
default :
return 1;
}
return 0;
}
)
{
mItemListPos = NULL;
}
#define BYTES_PRE_LINE 0x10
)
{
return;
}
continue;
}
}
}
}
}
} else {
}
}
}
}
}
)
{
mItemListPos = NULL;
}
)
{
SConfigItem *p;
while (mItemListHead != NULL) {
p = mItemListHead;
delete p;
}
mItemListPos = NULL;
}
static struct {
} gInternalTypesTable [] = {
{NULL, EFI_IFR_TYPE_OTHER, 0, 0}
};
)
{
return FALSE;
}
return TRUE;
}
}
return FALSE;
}
CHAR8 *
TrimHex (
)
{
Str++;
}
Str++;
}
Str++;
}
return Str;
}
_STR2U32 (
)
{
bool IsHex;
CHAR8 c;
//
// BUG: does not handle overflow here
//
}
}
if (c >= '0' && c <= '9') {
Value += (c - '0');
}
}
return Value;
}
)
{
mDataTypeList = New;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
VarStr++;
TName++;
}
*TName = '\0';
if (*VarStr == '.') {
VarStr++;
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
while((*VarStr != '\0') &&
(*VarStr != '.') &&
(*VarStr != '[') &&
(*VarStr != ']')) {
VarStr++;
FName++;
}
*FName = '\0';
switch (*VarStr) {
case '.' :
VarStr++;
case '\0':
return VFR_RETURN_SUCCESS;
case '[' :
VarStr++;
}
return VFR_RETURN_DATA_STRING_ERROR;
}
if (*VarStr == ']') {
VarStr++;
}
if (*VarStr == '.') {
VarStr++;
}
return VFR_RETURN_SUCCESS;
case ']':
return VFR_RETURN_DATA_STRING_ERROR;
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
//
// For type EFI_IFR_TYPE_TIME, because field name is not correctly wrote,
// add code to adjust it.
//
FName = "Hours";
FName = "Minuts";
FName = "Seconds";
}
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_UNDEFINED;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
//
// Framework Vfr file Array Index is from 1.
// But Uefi Vfr file Array Index is from 0.
//
if (ArrayIdx == 0) {
return VFR_RETURN_ERROR_ARRARY_NUM;
}
}
if ((ArrayIdx != INVALID_ARRAY_INDEX) && ((Field->mArrayNum == 0) || (Field->mArrayNum <= ArrayIdx))) {
return VFR_RETURN_ERROR_ARRARY_NUM;
}
//
// Be compatible with the current usage
// If ArraryIdx is not specified, the first one is used.
//
// if ArrayNum is larger than zero, ArraryIdx must be specified.
//
// if ((ArrayIdx == INVALID_ARRAY_INDEX) && (Field->mArrayNum > 0)) {
// return VFR_RETURN_ERROR_ARRARY_NUM;
// }
//
Offset = Field->mOffset + Field->mFieldType->mTotalSize * ((ArrayIdx == INVALID_ARRAY_INDEX) ? 0 : ArrayIdx);
return VFR_RETURN_SUCCESS;
}
)
{
return 0;
}
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
} else {
}
}
)
{
New = new SVfrDataType;
pYearField->mOffset = 0;
pYearField->mArrayNum = 0;
pMonthField->mArrayNum = 0;
pHoursField->mOffset = 0;
pHoursField->mArrayNum = 0;
pMinutesField->mArrayNum = 0;
pSecondsField->mArrayNum = 0;
pQuestionIdField->mOffset = 0;
pQuestionIdField->mArrayNum = 0;
pFormIdField->mArrayNum = 0;
pFormSetGuidField->mArrayNum = 0;
pDevicePathField->mArrayNum = 0;
} else {
}
}
}
}
)
{
mNewDataType = NULL;
mPackStack = NULL;
}
)
{
if (mNewDataType != NULL) {
delete mNewDataType;
}
while (mDataTypeList != NULL) {
delete pField;
}
delete pType;
}
while (mPackStack != NULL) {
pPack = mPackStack;
delete pPack;
}
}
)
{
if (Action & VFR_PACK_SHOW) {
}
if (Action & VFR_PACK_PUSH) {
return VFR_RETURN_FATAL_ERROR;
}
mPackStack = pNew;
}
if (Action & VFR_PACK_POP) {
if (mPackStack == NULL) {
}
}
}
}
if (Action & VFR_PACK_ASSIGN) {
gCVfrErrorHandle.PrintMsg (LineNum, NULL, "Error", "expected pragma parameter to be '1', '2', '4', '8', or '16'");
} else {
}
}
return VFR_RETURN_SUCCESS;
}
)
{
pNewType = new SVfrDataType;
pNewType->mTotalSize = 0;
}
)
{
if (mNewDataType == NULL) {
return VFR_RETURN_ERROR_SKIPED;
}
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_INVALID_PARAMETER;
}
return VFR_RETURN_REDEFINED;
}
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_INVALID_PARAMETER;
}
return VFR_RETURN_REDEFINED;
}
}
return VFR_RETURN_OUT_FOR_RESOURCES;
}
} else {
}
} else {
;
}
mNewDataType->mTotalSize = pNewField->mOffset + (pNewField->mFieldType->mTotalSize) * ((ArrayNum == 0) ? 1 : ArrayNum);
return VFR_RETURN_SUCCESS;
}
)
{
return;
}
}
if (mFirstNewDataTypeName == NULL) {
}
mNewDataType = NULL;
}
)
{
return VFR_RETURN_ERROR_SKIPED;
}
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_UNDEFINED;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
*Size = 0;
//
// For user defined data type, the size can't be got by this function.
//
if (DataType == EFI_IFR_TYPE_OTHER) {
return VFR_RETURN_SUCCESS;
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_UNDEFINED;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
*Size = 0;
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_UNDEFINED;
}
)
{
Offset = 0;
Size = 0;
//
// if it is not struct data type
//
while (*VarStr != '\0') {
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
*ListSize = 0;
(*ListSize)++;
}
}
if (*ListSize == 0) {
return VFR_RETURN_SUCCESS;
}
*ListSize = 0;
return VFR_RETURN_OUT_FOR_RESOURCES;
}
}
}
return VFR_RETURN_SUCCESS;
}
)
{
return FALSE;
}
return TRUE;
}
}
return FALSE;
}
)
{
fprintf (File, "\t\tstruct %s : mAlign [%d] mTotalSize [0x%x]\n\n", pTNode->mTypeName, pTNode->mAlign, pTNode->mTotalSize);
} else {
}
}
}
}
#ifdef CVFR_VARDATATYPEDB_DEBUG
)
{
printf ("***************************************************************\n");
printf ("\t\tstruct %s : mAlign [%x] mTotalSize [%x]\n\n", pTNode->mTypeName, pTNode->mAlign, pTNode->mTotalSize);
}
printf ("\t\t};\n");
printf ("---------------------------------------------------------------\n");
}
printf ("***************************************************************\n");
}
#endif
)
{
} else {
}
} else {
}
}
)
{
} else {
}
} else {
}
}
)
{
} else {
}
}
)
{
if (mVarStoreName != NULL) {
delete mVarStoreName;
}
if (mVarStoreType == EFI_VFR_VARSTORE_NAME) {
}
}
)
{
mFreeVarStoreIdBitMap[Index] = 0;
}
// Question ID 0 is reserved.
mFreeVarStoreIdBitMap[0] = 0x80000000;
}
)
{
while (mBufferVarStoreList != NULL) {
delete pNode;
}
while (mEfiVarStoreList != NULL) {
delete pNode;
}
while (mNameVarStoreList != NULL) {
delete pNode;
}
if (mNewVarStorageNode != NULL) {
delete mNewVarStorageNode;
}
}
)
{
//
// Assign the different ID range for the different type VarStore to support Framework Vfr
//
Index = 0;
Index = 0;
} else if (VarType == EFI_VFR_VARSTORE_EFI) {
Index = 1;
} else if (VarType == EFI_VFR_VARSTORE_NAME) {
Index = 2;
}
break;
}
}
}
}
return EFI_VARSTORE_ID_INVALID;
}
)
{
}
)
{
}
)
{
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_REDEFINED;
}
return VFR_RETURN_UNDEFINED;
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_OUT_FOR_RESOURCES;
}
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
}
return VFR_RETURN_REDEFINED;
}
if ((pNode = new SVfrVarStorageNode (Guid, StoreName, VarStoreId, NameStrId, VarSize, Flag)) == NULL) {
return VFR_RETURN_OUT_FOR_RESOURCES;
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_REDEFINED;
}
if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
} else {
return VFR_RETURN_VARSTOREID_REDEFINED;
}
}
return VFR_RETURN_OUT_FOR_RESOURCES;
}
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_SUCCESS;
}
)
{
//
// Framework VFR uses Data type name as varstore name, so don't need check again.
//
if (VfrCompatibleMode) {
return VFR_RETURN_UNDEFINED;
}
} else {
//
// More than one varstores referred the same data structures.
//
}
}
}
return VFR_RETURN_UNDEFINED;
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_SUCCESS;
}
}
//
// Assume that Data strucutre name is used as StoreName, and check again.
//
}
return ReturnCode;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
break;
}
}
//
// Assume that Data strucutre name is used as StoreName, and check again.
//
}
return ReturnCode;
}
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_SUCCESS;
}
}
//
// Assume that Data strucutre name is used as StoreName, and check again.
//
}
return ReturnCode;
}
)
{
if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
return VarStoreType;
}
return VarStoreType;
}
}
return VarStoreType;
}
}
return VarStoreType;
}
}
return VarStoreType;
}
)
{
if (VarStoreName == NULL) {
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_SUCCESS;
}
}
*VarStoreName = NULL;
return VFR_RETURN_UNDEFINED;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
if (mCurrVarStorageNode == NULL) {
return VFR_RETURN_GET_EFIVARSTORE_ERROR;
}
switch (Info->mVarTotalSize) {
case 1:
break;
case 2:
break;
case 4:
break;
case 8:
break;
default :
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_SUCCESS;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
if (mCurrVarStorageNode == NULL) {
return VFR_RETURN_GET_NVVARSTORE_ERROR;
}
//
// Framework Vfr file Index is from 1, but Uefi Vfr file Index is from 0.
//
if (VfrCompatibleMode) {
if (Index == 0) {
return VFR_RETURN_ERROR_ARRARY_NUM;
}
Index --;
}
return VFR_RETURN_SUCCESS;
}
)
{
break;
}
}
//
// Assume that Data strucutre name is used as StoreName, and check again.
//
}
return ReturnCode;
}
if (gCVfrBufferConfig.Write ('a', StoreName, NULL, EFI_IFR_TYPE_NUM_SIZE_8, Info.mInfo.mVarOffset, Info.mVarTotalSize, Value) != 0) {
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_SUCCESS;
}
)
{
} else {
}
}
)
{
delete mRefName;
}
}
)
{
}
)
{
while (mDefaultStoreList != NULL) {
delete pTmp;
}
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_REDEFINED;
}
}
if ((pNode = new SVfrDefaultStoreNode ((EFI_IFR_DEFAULTSTORE *)ObjBinAddr, RefName, DefaultStoreNameId, DefaultId)) == NULL) {
return VFR_RETURN_OUT_FOR_RESOURCES;
}
return VFR_RETURN_SUCCESS;
}
/*
* assign new reference name or new default store name id only if
* the original is invalid
*/
)
{
break;
}
}
return VFR_RETURN_UNDEFINED;
} else {
}
} else {
return VFR_RETURN_REDEFINED;
}
}
}
}
return VFR_RETURN_SUCCESS;
}
)
{
return TRUE;
}
}
return FALSE;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_UNDEFINED;
}
)
{
INTN Returnvalue = 0;
if (VarStoreName == NULL) {
return VFR_RETURN_FATAL_ERROR;
}
break;
}
}
return VFR_RETURN_UNDEFINED;
}
if ((Returnvalue = gCVfrBufferConfig.Write ('a', VarStoreName, NewAltCfg, Type, Info.mInfo.mVarOffset, Info.mVarTotalSize, Value)) != 0) {
goto WriteError;
}
}
return VFR_RETURN_SUCCESS;
return (EFI_VFR_RETURN_CODE)Returnvalue;
}
)
{
} else {
}
}
)
{
delete mRuleName;
}
}
{
}
CVfrRulesDB::~CVfrRulesDB ()
{
delete pNode;
}
}
)
{
return ;
}
return ;
}
mFreeRuleId++;
}
)
{
return EFI_RULE_ID_INVALID;
}
}
}
return EFI_RULE_ID_INVALID;
}
)
{
mVarTotalSize = 0;
}
)
{
}
EFI_VARSTORE_INFO::operator == (
)
{
return TRUE;
}
return FALSE;
}
)
{
break;
}
}
}
}
return EFI_QUESTION_ID_INVALID;
}
)
{
}
)
{
}
)
{
}
)
{
} else {
}
} else {
}
}
)
{
delete mName;
}
delete mVarIdStr;
}
}
{
mFreeQIdBitMap[Index] = 0;
}
// Question ID 0 is reserved.
mFreeQIdBitMap[0] = 0x80000000;
}
{
while (mQuestionList != NULL) {
delete pNode;
}
}
//
// Reset to init state
//
)
{
while (mQuestionList != NULL) {
delete pNode;
}
mFreeQIdBitMap[Index] = 0;
}
// Question ID 0 is reserved.
mFreeQIdBitMap[0] = 0x80000000;
}
)
{
}
}
)
{
return VFR_RETURN_REDEFINED;
}
return VFR_RETURN_OUT_FOR_RESOURCES;
}
if (QuestionId == EFI_QUESTION_ID_INVALID) {
QuestionId = GetFreeQuestionId ();
} else {
//
// For Framework Vfr, don't check question ID conflict.
//
delete pNode;
return VFR_RETURN_QUESTIONID_REDEFINED;
}
}
return VFR_RETURN_SUCCESS;
}
)
{
return;
}
goto Err;
}
goto Err;
}
goto Err;
}
if (QuestionId == EFI_QUESTION_ID_INVALID) {
QuestionId = GetFreeQuestionId ();
} else {
goto Err;
}
}
mQuestionList = pNode[0];
return;
Err:
}
}
}
)
{
return;
}
}
}
}
goto Err;
}
goto Err;
}
goto Err;
}
if (QuestionId == EFI_QUESTION_ID_INVALID) {
QuestionId = GetFreeQuestionId ();
} else {
goto Err;
}
}
mQuestionList = pNode[0];
}
}
return;
Err:
}
}
}
}
)
{
return;
}
goto Err;
}
goto Err;
}
goto Err;
}
if (QuestionId == EFI_QUESTION_ID_INVALID) {
QuestionId = GetFreeQuestionId ();
} else {
goto Err;
}
}
mQuestionList = pNode[0];
return;
Err:
}
}
}
)
{
return;
}
}
}
}
goto Err;
}
goto Err;
}
goto Err;
}
if (QuestionId == EFI_QUESTION_ID_INVALID) {
QuestionId = GetFreeQuestionId ();
} else {
goto Err;
}
}
mQuestionList = pNode[0];
}
}
return;
Err:
}
}
}
}
)
{
return;
}
}
}
}
}
goto Err;
}
goto Err;
}
goto Err;
}
goto Err;
}
if (QuestionId == EFI_QUESTION_ID_INVALID) {
QuestionId = GetFreeQuestionId ();
} else {
goto Err;
}
}
mQuestionList = pNode[0];
return;
Err:
}
}
}
}
)
{
// don't update
return VFR_RETURN_SUCCESS;
}
//
// For Framework Vfr, don't check question ID conflict.
//
return VFR_RETURN_REDEFINED;
}
break;
}
}
return VFR_RETURN_UNDEFINED;
}
return VFR_RETURN_SUCCESS;
}
)
{
BitMask = 0x00000000;
*QType = QUESTION_NORMAL;
}
return ;
}
continue;
}
}
continue;
}
}
}
break;
}
return ;
}
)
{
if (QuestionId == EFI_QUESTION_ID_INVALID) {
return VFR_RETURN_INVALID_PARAMETER;
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_UNDEFINED;
}
)
{
return VFR_RETURN_FATAL_ERROR;
}
return VFR_RETURN_SUCCESS;
}
}
return VFR_RETURN_UNDEFINED;
}
{
}
CVfrStringDB::~CVfrStringDB ()
{
if (mStringFileName != NULL) {
delete mStringFileName;
}
}
{
if (StringFileName == NULL) {
return;
}
if (mStringFileName == NULL) {
return;
}
}
/**
Returns TRUE or FALSE whether SupportedLanguages contains the best matching language
from a set of supported languages.
@param[in] SupportedLanguages A pointer to a Null-terminated ASCII string that
contains a set of language codes.
@param[in] Language A variable that contains pointers to Null-terminated
ASCII strings that contain one language codes.
@retval FALSE The best matching language could not be found in SupportedLanguages.
@retval TRUE The best matching language could be found in SupportedLanguages.
**/
)
{
return FALSE;
}
//
// Determine the length of the first RFC 4646 language code in Language
//
for (LanguageLength = 0; Language[LanguageLength] != 0 && Language[LanguageLength] != ';'; LanguageLength++);
//
// Trim back the length of Language used until it is empty
//
while (LanguageLength > 0) {
//
// Loop through all language codes in SupportedLanguages
//
//
// Skip ';' characters in Supported
//
//
// Determine the length of the next language code in Supported
//
for (CompareLength = 0; Supported[CompareLength] != 0 && Supported[CompareLength] != ';'; CompareLength++);
//
// If Language is longer than the Supported, then skip to the next language
//
if (LanguageLength > CompareLength) {
continue;
}
//
// See if the first LanguageLength characters in Supported match Language
//
return TRUE;
}
}
//
// Trim Language from the right to the next '-' character
//
}
//
// No matches were found
//
return FALSE;
}
CHAR8 *
)
{
if (mStringFileName == '\0' ) {
return NULL;
}
return NULL;
}
//
// Get file length.
//
//
// Get file data.
//
return NULL;
}
//
// Check the String package.
//
delete StringPtr;
return NULL;
}
//
// Search the language, get best language base on RFC 4647 matching algorithm.
//
//
// If can't find string package base on language, just return the first string package.
//
break;
}
}
//
// Find the string block according the stringId.
//
if (Status != EFI_SUCCESS) {
delete StringPtr;
return NULL;
}
//
// Get varstore name according the string type.
//
switch (BlockType) {
case EFI_HII_SIBT_STRING_SCSU:
break;
case EFI_HII_SIBT_STRING_UCS2:
while (*UnicodeString != '\0') {
}
*DestTmp = '\0';
break;
default:
break;
}
delete StringPtr;
return VarStoreName;
}
)
{
CurrentStringId = 1;
//
// Parse the string blocks to get the string text and font.
//
BlockSize = 0;
Offset = 0;
while (*BlockHdr != EFI_HII_SIBT_END) {
switch (*BlockHdr) {
case EFI_HII_SIBT_STRING_SCSU:
Offset = sizeof (EFI_HII_STRING_BLOCK);
break;
break;
if (CurrentStringId == StringId) {
return EFI_SUCCESS;
}
}
break;
memcpy (
sizeof (UINT16)
);
if (CurrentStringId == StringId) {
return EFI_SUCCESS;
}
}
break;
case EFI_HII_SIBT_STRING_UCS2:
Offset = sizeof (EFI_HII_STRING_BLOCK);
//
// Use StringSize to store the size of the specified string, including the NULL
// terminator.
//
break;
//
// Use StrSize to store the size of the specified string, including the NULL
// terminator.
//
break;
BlockSize += StringSize;
if (CurrentStringId == StringId) {
return EFI_SUCCESS;
}
}
break;
memcpy (
sizeof (UINT16)
);
BlockSize += StringSize;
if (CurrentStringId == StringId) {
return EFI_SUCCESS;
}
}
break;
case EFI_HII_SIBT_DUPLICATE:
if (CurrentStringId == StringId) {
//
// Incoming StringId is an id of a duplicate string block.
// Update the StringId to be the previous string block.
// Go back to the header of string block to search.
//
memcpy (
&StringId,
BlockHdr + sizeof (EFI_HII_STRING_BLOCK),
sizeof (EFI_STRING_ID)
);
CurrentStringId = 1;
BlockSize = 0;
} else {
BlockSize += sizeof (EFI_HII_SIBT_DUPLICATE_BLOCK);
}
break;
case EFI_HII_SIBT_SKIP1:
BlockSize += sizeof (EFI_HII_SIBT_SKIP1_BLOCK);
break;
case EFI_HII_SIBT_SKIP2:
BlockSize += sizeof (EFI_HII_SIBT_SKIP2_BLOCK);
break;
case EFI_HII_SIBT_EXT1:
memcpy (
&Length8,
sizeof (UINT8)
);
break;
case EFI_HII_SIBT_EXT2:
break;
case EFI_HII_SIBT_EXT4:
memcpy (
&Length32,
sizeof (UINT32)
);
break;
default:
break;
}
//
// if only one skip item, return EFI_NOT_FOUND.
//
return EFI_NOT_FOUND;
} else {
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
}
}
return EFI_NOT_FOUND;
}
)
{
StringSize = sizeof (CHAR16);
while (*StringPtr++ != L'\0') {
StringSize += sizeof (CHAR16);
}
return StringSize;
}