21UINTN mExpressionEvaluationStackOffset = 0;
73 Size = EXPRESSION_STACK_SIZE_INCREMENT;
74 if (*StackPtr !=
NULL) {
75 Size = Size + (*StackEnd - *Stack);
79 if (NewStack ==
NULL) {
80 return EFI_OUT_OF_RESOURCES;
83 if (*StackPtr !=
NULL) {
102 *StackPtr = NewStack + (*StackPtr - *Stack);
104 *StackEnd = NewStack + Size;
134 if (*StackPtr >= *StackEnd) {
138 Status =
GrowStack (Stack, StackPtr, StackEnd);
139 if (EFI_ERROR (Status)) {
148 if (Data->Type == EFI_IFR_TYPE_BUFFER) {
150 ASSERT ((*StackPtr)->Buffer !=
NULL);
153 *StackPtr = *StackPtr + 1;
179 if (*StackPtr == Stack) {
180 return EFI_ACCESS_DENIED;
186 *StackPtr = *StackPtr - 1;
200 mCurrentExpressionPointer = mCurrentExpressionStack;
201 mFormExpressionPointer = mFormExpressionStack;
202 mStatementExpressionPointer = mStatementExpressionStack;
203 mOptionExpressionPointer = mOptionExpressionStack;
222 Data.Type = EFI_IFR_TYPE_NUM_SIZE_64;
223 Data.Value.u64 = (UINT64)(
UINTN)Pointer;
226 &mCurrentExpressionStack,
227 &mCurrentExpressionPointer,
228 &mCurrentExpressionEnd,
251 mCurrentExpressionStack,
252 &mCurrentExpressionPointer,
256 *Pointer = (VOID *)(
UINTN)Data.Value.u64;
270 mMapExpressionListPointer = mMapExpressionListStack;
299 Size = EXPRESSION_STACK_SIZE_INCREMENT;
300 if (*StackPtr !=
NULL) {
301 Size = Size + (*StackEnd - *Stack);
305 if (NewStack ==
NULL) {
306 return EFI_OUT_OF_RESOURCES;
309 if (*StackPtr !=
NULL) {
316 (*StackEnd - *Stack) * MemberSize
328 *StackPtr = NewStack + (*StackPtr - *Stack);
330 *StackEnd = NewStack + Size;
360 if (*StackPtr >= *StackEnd) {
365 if (EFI_ERROR (Status)) {
374 *StackPtr = *StackPtr + 1;
400 if (*StackPtr == Stack) {
401 return EFI_ACCESS_DENIED;
407 *StackPtr = *StackPtr - 1;
424 IN EXPRESS_LEVEL Level
429 return mFormExpressionPointer - mFormExpressionStack;
430 case ExpressStatement:
431 return mStatementExpressionPointer - mStatementExpressionStack;
433 return mOptionExpressionPointer - mOptionExpressionStack;
451 IN EXPRESS_LEVEL Level
456 return mFormExpressionStack;
457 case ExpressStatement:
458 return mStatementExpressionStack;
460 return mOptionExpressionStack;
481 IN EXPRESS_LEVEL Level
487 &mFormExpressionStack,
488 &mFormExpressionPointer,
492 case ExpressStatement:
494 &mStatementExpressionStack,
495 &mStatementExpressionPointer,
496 &mStatementExpressionEnd,
501 &mOptionExpressionStack,
502 &mOptionExpressionPointer,
503 &mOptionExpressionEnd,
508 return EFI_INVALID_PARAMETER;
524 IN EXPRESS_LEVEL Level
532 mFormExpressionStack,
533 &mFormExpressionPointer,
537 case ExpressStatement:
539 mStatementExpressionStack,
540 &mStatementExpressionPointer,
546 mOptionExpressionStack,
547 &mOptionExpressionPointer,
553 return EFI_INVALID_PARAMETER;
573 Data.Type = EFI_IFR_TYPE_NUM_SIZE_64;
574 Data.Value.u64 = (UINT64)(
UINTN)Pointer;
577 &mMapExpressionListStack,
578 &mMapExpressionListPointer,
579 &mMapExpressionListEnd,
602 mMapExpressionListStack,
603 &mMapExpressionListPointer,
607 *Pointer = (VOID *)(
UINTN)Data.Value.u64;
621 mOpCodeScopeStackPointer = mOpCodeScopeStack;
641 Data.Type = EFI_IFR_TYPE_NUM_SIZE_8;
642 Data.Value.u8 = Operand;
646 &mOpCodeScopeStackPointer,
647 &mOpCodeScopeStackEnd,
672 &mOpCodeScopeStackPointer,
676 *Operand = Data.Value.u8;
697 &mExpressionEvaluationStack,
698 &mExpressionEvaluationStackPointer,
699 &mExpressionEvaluationStackEnd,
719 mExpressionEvaluationStack + mExpressionEvaluationStackOffset,
720 &mExpressionEvaluationStackPointer,
735 UINTN TempStackOffset;
737 TempStackOffset = mExpressionEvaluationStackOffset;
738 mExpressionEvaluationStackOffset = mExpressionEvaluationStackPointer - mExpressionEvaluationStack;
739 return TempStackOffset;
753 mExpressionEvaluationStackOffset = StackOffset;
776 while (!
IsNull (&FormSet->FormListHead, Link)) {
777 Form = FORM_BROWSER_FORM_FROM_LINK (Link);
779 if (Form->FormId == FormId) {
808 if ((QuestionId == 0) || (Form ==
NULL)) {
816 while (!
IsNull (&Form->StatementListHead, Link)) {
817 Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link);
819 if (Question->QuestionId == QuestionId) {
823 Link =
GetNextNode (&Form->StatementListHead, Link);
854 if (Question !=
NULL) {
862 while (!
IsNull (&FormSet->FormListHead, Link)) {
863 Form = FORM_BROWSER_FORM_FROM_LINK (Link);
866 if (Question !=
NULL) {
871 if (Question->Storage->Type == EFI_HII_VARSTORE_EFI_VARIABLE) {
904 while (!
IsNull (&Form->ExpressionListHead, Link)) {
905 Expression = FORM_EXPRESSION_FROM_LINK (Link);
907 if ((Expression->Type == EFI_HII_EXPRESSION_RULE) && (Expression->RuleId == RuleId)) {
911 Link =
GetNextNode (&Form->ExpressionListHead, Link);
931 if (mUnicodeCollation !=
NULL) {
940 Status =
gBS->LocateProtocol (
941 &gEfiUnicodeCollation2ProtocolGuid,
943 (VOID **)&mUnicodeCollation
959 while (*String != 0) {
960 if ((*String >=
'a') && (*String <=
'z')) {
961 *String = (UINT16)((*String) & ((UINT16) ~0x20));
985 switch (Value->Type) {
986 case EFI_IFR_TYPE_BUFFER:
987 case EFI_IFR_TYPE_DATE:
988 case EFI_IFR_TYPE_TIME:
989 case EFI_IFR_TYPE_REF:
1011 switch (Value->Type) {
1012 case EFI_IFR_TYPE_NUM_SIZE_8:
1013 case EFI_IFR_TYPE_NUM_SIZE_16:
1014 case EFI_IFR_TYPE_NUM_SIZE_32:
1015 case EFI_IFR_TYPE_NUM_SIZE_64:
1016 case EFI_IFR_TYPE_BOOLEAN:
1040 switch (Value->Type) {
1041 case EFI_IFR_TYPE_BUFFER:
1042 return Value->BufferLen;
1044 case EFI_IFR_TYPE_DATE:
1047 case EFI_IFR_TYPE_TIME:
1050 case EFI_IFR_TYPE_REF:
1074 switch (Value->Type) {
1075 case EFI_IFR_TYPE_BUFFER:
1076 return Value->Buffer;
1078 case EFI_IFR_TYPE_DATE:
1079 return (UINT8 *)(&Value->Value.date);
1081 case EFI_IFR_TYPE_TIME:
1082 return (UINT8 *)(&Value->Value.time);
1084 case EFI_IFR_TYPE_REF:
1085 return (UINT8 *)(&Value->Value.ref);
1113 CHAR16 *PrintFormat;
1121 if (EFI_ERROR (Status)) {
1125 switch (Value.Type) {
1126 case EFI_IFR_TYPE_NUM_SIZE_8:
1127 case EFI_IFR_TYPE_NUM_SIZE_16:
1128 case EFI_IFR_TYPE_NUM_SIZE_32:
1129 case EFI_IFR_TYPE_NUM_SIZE_64:
1133 case EFI_IFR_STRING_SIGNED_DEC:
1134 PrintFormat = L
"%ld";
1137 case EFI_IFR_STRING_LOWERCASE_HEX:
1138 PrintFormat = L
"%lx";
1141 case EFI_IFR_STRING_UPPERCASE_HEX:
1142 PrintFormat = L
"%lX";
1146 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1150 UnicodeSPrint (Buffer, BufferSize, PrintFormat, Value.Value.u64);
1154 case EFI_IFR_TYPE_STRING:
1158 case EFI_IFR_TYPE_BOOLEAN:
1159 String = (Value.Value.b) ? L
"True" : L
"False";
1162 case EFI_IFR_TYPE_BUFFER:
1163 case EFI_IFR_TYPE_DATE:
1164 case EFI_IFR_TYPE_TIME:
1165 case EFI_IFR_TYPE_REF:
1170 if (Value.Type == EFI_IFR_TYPE_BUFFER) {
1171 SrcLen = Value.BufferLen;
1172 SrcBuf = Value.Buffer;
1179 ASSERT (TmpBuf !=
NULL);
1181 CopyMem (TmpBuf, SrcBuf, SrcLen);
1182 PrintFormat = L
"%a";
1185 CopyMem (TmpBuf, SrcBuf, SrcLen *
sizeof (CHAR16));
1186 PrintFormat = L
"%s";
1189 UnicodeSPrint (Buffer,
sizeof (Buffer), PrintFormat, TmpBuf);
1192 if (Value.Type == EFI_IFR_TYPE_BUFFER) {
1199 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1203 Result->Type = EFI_IFR_TYPE_STRING;
1204 Result->Value.string =
NewString (String, FormSet->HiiHandle);
1230 if (EFI_ERROR (Status)) {
1234 if ((Value.Type >= EFI_IFR_TYPE_OTHER) && !
IsTypeInBuffer (&Value)) {
1235 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1240 if (Value.Type == EFI_IFR_TYPE_STRING) {
1241 String =
GetToken (Value.Value.string, FormSet->HiiHandle);
1242 if (String ==
NULL) {
1243 return EFI_NOT_FOUND;
1247 StringPtr =
StrStr (String, L
"0X");
1248 if (StringPtr !=
NULL) {
1263 if (Value.Type == EFI_IFR_TYPE_BUFFER) {
1267 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1274 if (Value.Type == EFI_IFR_TYPE_BUFFER) {
1281 Result->Type = EFI_IFR_TYPE_NUM_SIZE_64;
1320 ZeroMem (Value,
sizeof (Value));
1323 if (EFI_ERROR (Status)) {
1328 if (EFI_ERROR (Status)) {
1332 for (Index = 0; Index < 2; Index++) {
1333 if ((Value[Index].Type != EFI_IFR_TYPE_STRING) && !
IsTypeInBuffer (&Value[Index])) {
1334 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1339 if (Value[Index].Type == EFI_IFR_TYPE_STRING) {
1340 String[Index] =
GetToken (Value[Index].Value.string, FormSet->HiiHandle);
1341 if (String[Index] ==
NULL) {
1342 Status = EFI_NOT_FOUND;
1348 if (Value[0].Type == EFI_IFR_TYPE_STRING) {
1350 MaxLen = (
StrSize (String[1]) + Size) /
sizeof (CHAR16);
1352 ASSERT (StringPtr !=
NULL);
1353 StrCpyS (StringPtr, MaxLen, String[1]);
1354 StrCatS (StringPtr, MaxLen, String[0]);
1356 Result->Type = EFI_IFR_TYPE_STRING;
1357 Result->Value.string =
NewString (StringPtr, FormSet->HiiHandle);
1359 Result->Type = EFI_IFR_TYPE_BUFFER;
1362 Result->BufferLen = (UINT16)(Length0 + Length1);
1365 ASSERT (Result->Buffer !=
NULL);
1368 ASSERT (TmpBuf !=
NULL);
1369 CopyMem (Result->Buffer, TmpBuf, Length0);
1371 ASSERT (TmpBuf !=
NULL);
1372 CopyMem (&Result->Buffer[Length0], TmpBuf, Length1);
1376 if (Value[0].Buffer !=
NULL) {
1380 if (Value[1].Buffer !=
NULL) {
1384 if (String[0] !=
NULL) {
1388 if (String[1] !=
NULL) {
1392 if (StringPtr !=
NULL) {
1427 ZeroMem (Value,
sizeof (Value));
1430 if (EFI_ERROR (Status)) {
1435 if (EFI_ERROR (Status)) {
1439 for (Index = 0; Index < 2; Index++) {
1440 if (Value[Index].Type != EFI_IFR_TYPE_STRING) {
1441 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1446 String[Index] =
GetToken (Value[Index].Value.string, FormSet->HiiHandle);
1447 if (String[Index] ==
NULL) {
1448 Status = EFI_NOT_FOUND;
1453 Result->Type = EFI_IFR_TYPE_BOOLEAN;
1454 Result->Value.b = mUnicodeCollation->MetaiMatch (mUnicodeCollation, String[0], String[1]);
1457 if (String[0] !=
NULL) {
1461 if (String[1] !=
NULL) {
1494 UINTN RegExSyntaxTypeListSize;
1496 UINTN CapturesCount;
1504 HandleBuffer =
NULL;
1505 RegExSyntaxTypeList =
NULL;
1507 ZeroMem (Value,
sizeof (Value));
1510 if (EFI_ERROR (Status)) {
1515 if (EFI_ERROR (Status)) {
1519 for (Index = 0; Index < 2; Index++) {
1520 if (Value[Index].Type != EFI_IFR_TYPE_STRING) {
1521 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1526 String[Index] =
GetToken (Value[Index].Value.string, FormSet->HiiHandle);
1527 if (String[Index] ==
NULL) {
1528 Status = EFI_NOT_FOUND;
1534 HandleBuffer =
NULL;
1535 Status =
gBS->LocateHandle (
1537 &gEfiRegularExpressionProtocolGuid,
1542 if (Status == EFI_BUFFER_TOO_SMALL) {
1544 if (HandleBuffer ==
NULL) {
1545 Status = EFI_OUT_OF_RESOURCES;
1549 Status =
gBS->LocateHandle (
1551 &gEfiRegularExpressionProtocolGuid,
1558 if (EFI_ERROR (Status)) {
1559 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1564 ASSERT (HandleBuffer !=
NULL);
1565 for ( Index = 0; Index < BufferSize /
sizeof (
EFI_HANDLE); Index++) {
1566 Status =
gBS->HandleProtocol (
1567 HandleBuffer[Index],
1568 &gEfiRegularExpressionProtocolGuid,
1569 (VOID **)&RegularExpressionProtocol
1571 if (EFI_ERROR (Status)) {
1575 RegExSyntaxTypeListSize = 0;
1576 RegExSyntaxTypeList =
NULL;
1578 Status = RegularExpressionProtocol->GetInfo (
1579 RegularExpressionProtocol,
1580 &RegExSyntaxTypeListSize,
1583 if (Status == EFI_BUFFER_TOO_SMALL) {
1585 if (RegExSyntaxTypeList ==
NULL) {
1586 Status = EFI_OUT_OF_RESOURCES;
1590 Status = RegularExpressionProtocol->GetInfo (
1591 RegularExpressionProtocol,
1592 &RegExSyntaxTypeListSize,
1595 }
else if (EFI_ERROR (Status)) {
1599 for (GuidIndex = 0; GuidIndex < RegExSyntaxTypeListSize /
sizeof (
EFI_GUID); GuidIndex++) {
1600 if (
CompareGuid (&RegExSyntaxTypeList[GuidIndex], SyntaxType)) {
1604 Result->Type = EFI_IFR_TYPE_BOOLEAN;
1605 Status = RegularExpressionProtocol->MatchString (
1606 RegularExpressionProtocol,
1618 if (RegExSyntaxTypeList !=
NULL) {
1627 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1631 if (String[0] !=
NULL) {
1635 if (String[1] !=
NULL) {
1639 if (RegExSyntaxTypeList !=
NULL) {
1643 if (HandleBuffer !=
NULL) {
1675 ZeroMem (Value,
sizeof (Value));
1677 if (Format > EFI_IFR_FF_CASE_INSENSITIVE) {
1678 return EFI_INVALID_PARAMETER;
1682 if (EFI_ERROR (Status)) {
1687 if (EFI_ERROR (Status)) {
1692 if (EFI_ERROR (Status)) {
1696 if (Value[0].Type > EFI_IFR_TYPE_NUM_SIZE_64) {
1697 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1701 Base = (
UINTN)Value[0].Value.u64;
1709 for (Index = 0; Index < 2; Index++) {
1710 if (Value[Index + 1].Type != EFI_IFR_TYPE_STRING) {
1711 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1716 String[Index] =
GetToken (Value[Index + 1].Value.string, FormSet->HiiHandle);
1717 if (String[Index] ==
NULL) {
1718 Status = EFI_NOT_FOUND;
1722 if (Format == EFI_IFR_FF_CASE_INSENSITIVE) {
1730 Result->Type = EFI_IFR_TYPE_NUM_SIZE_64;
1731 if (Base >=
StrLen (String[1])) {
1732 Result->Value.u64 = 0xFFFFFFFFFFFFFFFFULL;
1734 StringPtr =
StrStr (String[1] + Base, String[0]);
1735 Result->Value.u64 = (StringPtr ==
NULL) ? 0xFFFFFFFFFFFFFFFFULL : (StringPtr - String[1]);
1739 if (String[0] !=
NULL) {
1743 if (String[1] !=
NULL) {
1775 ZeroMem (Value,
sizeof (Value));
1778 if (EFI_ERROR (Status)) {
1783 if (EFI_ERROR (Status)) {
1788 if (EFI_ERROR (Status)) {
1792 if (Value[0].Type > EFI_IFR_TYPE_NUM_SIZE_64) {
1793 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1797 Length = (
UINTN)Value[0].Value.u64;
1799 if (Value[1].Type > EFI_IFR_TYPE_NUM_SIZE_64) {
1800 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1804 Base = (
UINTN)Value[1].Value.u64;
1806 if ((Value[2].Type != EFI_IFR_TYPE_STRING) && !
IsTypeInBuffer (&Value[2])) {
1807 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1811 if (Value[2].Type == EFI_IFR_TYPE_STRING) {
1812 String =
GetToken (Value[2].Value.string, FormSet->HiiHandle);
1813 if (String ==
NULL) {
1814 return EFI_NOT_FOUND;
1817 if ((Length == 0) || (Base >=
StrLen (String))) {
1818 SubString = gEmptyString;
1820 SubString = String + Base;
1821 if ((Base + Length) <
StrLen (String)) {
1822 SubString[Length] = L
'\0';
1826 Result->Type = EFI_IFR_TYPE_STRING;
1827 Result->Value.string =
NewString (SubString, FormSet->HiiHandle);
1834 Result->Type = EFI_IFR_TYPE_BUFFER;
1835 if ((Length == 0) || (Base >= BufferLen)) {
1836 Result->BufferLen = 0;
1837 Result->Buffer =
NULL;
1839 Result->BufferLen = (UINT16)((BufferLen - Base) < Length ? (BufferLen - Base) : Length);
1841 ASSERT (Result->Buffer !=
NULL);
1842 CopyMem (Result->Buffer, &Buffer[Base], Result->BufferLen);
1845 if (Value[2].Type == EFI_IFR_TYPE_BUFFER) {
1878 ZeroMem (Value,
sizeof (Value));
1881 if (EFI_ERROR (Status)) {
1886 if (EFI_ERROR (Status)) {
1891 if (EFI_ERROR (Status)) {
1895 if (Value[0].Type > EFI_IFR_TYPE_NUM_SIZE_64) {
1896 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1900 Count = (
UINTN)Value[0].Value.u64;
1908 for (Index = 0; Index < 2; Index++) {
1909 if (Value[Index + 1].Type != EFI_IFR_TYPE_STRING) {
1910 Result->Type = EFI_IFR_TYPE_UNDEFINED;
1915 String[Index] =
GetToken (Value[Index + 1].Value.string, FormSet->HiiHandle);
1916 if (String[Index] ==
NULL) {
1917 Status = EFI_NOT_FOUND;
1922 Delimiter = String[0];
1923 SubString = String[1];
1925 SubString =
StrStr (SubString, Delimiter);
1926 if (SubString !=
NULL) {
1930 SubString = SubString +
StrLen (Delimiter);
1938 if (SubString ==
NULL) {
1942 SubString = gEmptyString;
1947 StringPtr =
StrStr (SubString, Delimiter);
1948 if (StringPtr !=
NULL) {
1953 Result->Type = EFI_IFR_TYPE_STRING;
1954 Result->Value.string =
NewString (SubString, FormSet->HiiHandle);
1957 if (String[0] !=
NULL) {
1961 if (String[1] !=
NULL) {
1995 ZeroMem (Value,
sizeof (Value));
1998 if (EFI_ERROR (Status)) {
2003 if (EFI_ERROR (Status)) {
2008 if (EFI_ERROR (Status)) {
2012 if (Value[0].Type > EFI_IFR_TYPE_NUM_SIZE_64) {
2013 Result->Type = EFI_IFR_TYPE_UNDEFINED;
2017 Base = (
UINTN)Value[0].Value.u64;
2025 for (Index = 0; Index < 2; Index++) {
2026 if (Value[Index + 1].Type != EFI_IFR_TYPE_STRING) {
2027 Result->Type = EFI_IFR_TYPE_UNDEFINED;
2032 String[Index] =
GetToken (Value[Index + 1].Value.string, FormSet->HiiHandle);
2033 if (String[Index] ==
NULL) {
2034 Status = EFI_NOT_FOUND;
2039 if (Base >=
StrLen (String[1])) {
2040 Result->Type = EFI_IFR_TYPE_UNDEFINED;
2046 StringPtr = String[1] + Base;
2047 Charset = String[0];
2048 while (*StringPtr != 0 && !Found) {
2050 while (Charset[Index] != 0) {
2051 if ((*StringPtr >= Charset[Index]) && (*StringPtr <= Charset[Index + 1])) {
2052 if (Flags == EFI_IFR_FLAGS_FIRST_MATCHING) {
2057 if (Flags == EFI_IFR_FLAGS_FIRST_NON_MATCHING) {
2074 Result->Type = EFI_IFR_TYPE_NUM_SIZE_64;
2075 Result->Value.u64 = StringPtr - String[1];
2078 if (String[0] !=
NULL) {
2082 if (String[1] !=
NULL) {
2103 switch (Value->Type) {
2104 case EFI_IFR_TYPE_NUM_SIZE_8:
2105 Temp = Value->Value.u8;
2108 case EFI_IFR_TYPE_NUM_SIZE_16:
2109 Temp = Value->Value.u16;
2112 case EFI_IFR_TYPE_NUM_SIZE_32:
2113 Temp = Value->Value.u32;
2116 case EFI_IFR_TYPE_BOOLEAN:
2117 Temp = Value->Value.b;
2120 case EFI_IFR_TYPE_TIME:
2121 Temp = Value->Value.u32 & 0xffffff;
2124 case EFI_IFR_TYPE_DATE:
2125 Temp = Value->Value.u32;
2132 Value->Value.u64 = Temp;
2152 switch (Value->Type) {
2153 case EFI_IFR_TYPE_NUM_SIZE_8:
2154 RetVal = Value->Value.u8;
2157 case EFI_IFR_TYPE_NUM_SIZE_16:
2158 RetVal = Value->Value.u16;
2161 case EFI_IFR_TYPE_NUM_SIZE_32:
2162 RetVal = Value->Value.u32;
2165 case EFI_IFR_TYPE_BOOLEAN:
2166 RetVal = Value->Value.b;
2169 case EFI_IFR_TYPE_DATE:
2170 RetVal = *(UINT64 *)&Value->Value.date;
2173 case EFI_IFR_TYPE_TIME:
2174 RetVal = (*(UINT64 *)&Value->Value.time) & 0xffffff;
2178 RetVal = Value->Value.u64;
2217 if ((Value1->Type == EFI_IFR_TYPE_STRING) && (Value2->Type == EFI_IFR_TYPE_STRING)) {
2218 if ((Value1->Value.string == 0) || (Value2->Value.string == 0)) {
2222 return EFI_INVALID_PARAMETER;
2225 if (Value1->Value.string == Value2->Value.string) {
2230 Str1 =
GetToken (Value1->Value.string, HiiHandle);
2235 return EFI_NOT_FOUND;
2238 Str2 =
GetToken (Value2->Value.string, HiiHandle);
2241 return EFI_NOT_FOUND;
2244 *Result =
StrCmp (Str1, Str2);
2261 Len = Buf1Len > Buf2Len ? Buf2Len : Buf1Len;
2263 if ((*Result == 0) && (Buf1Len != Buf2Len)) {
2268 *Result = Buf1Len > Buf2Len ? 1 : -1;
2281 }
else if (Temp64 < 0) {
2290 return EFI_UNSUPPORTED;
2307 EFI_USER_PROFILE_HANDLE UserProfileHandle;
2308 EFI_USER_INFO_HANDLE UserInfoHandle;
2312 UINTN AccessControlDataSize;
2316 if (mUserManager ==
NULL) {
2317 Status =
gBS->LocateProtocol (
2318 &gEfiUserManagerProtocolGuid,
2320 (VOID **)&mUserManager
2322 if (EFI_ERROR (Status)) {
2332 Status = mUserManager->Current (mUserManager, &UserProfileHandle);
2340 for (UserInfoHandle =
NULL; ;) {
2341 Status = mUserManager->GetNextInfo (mUserManager, UserProfileHandle, &UserInfoHandle);
2342 if (EFI_ERROR (Status)) {
2347 Status = mUserManager->GetInfo (mUserManager, UserProfileHandle, UserInfoHandle,
NULL, &UserInfoSize);
2348 if (Status != EFI_BUFFER_TOO_SMALL) {
2353 if (UserInfo ==
NULL) {
2357 Status = mUserManager->GetInfo (mUserManager, UserProfileHandle, UserInfoHandle, UserInfo, &UserInfoSize);
2358 if (EFI_ERROR (Status) ||
2378 UserPermissionsGuid = (
EFI_GUID *)(AccessControl + 1);
2380 while (AccessControlDataSize >=
sizeof (
EFI_GUID)) {
2386 UserPermissionsGuid++;
2387 AccessControlDataSize -=
sizeof (
EFI_GUID);
2391 RemainSize -= AccessControl->
Size;
2418 IN EFI_QUESTION_ID QuestionId,
2434 (DevicePath !=
NULL && InputHiiHandle ==
NULL) ||
2435 (DevicePath ==
NULL && InputHiiHandle !=
NULL)
2446 if (DevicePath !=
NULL) {
2448 if (HiiHandle ==
NULL) {
2452 HiiHandle = InputHiiHandle;
2455 ASSERT (HiiHandle !=
NULL);
2461 ASSERT (FormSet !=
NULL);
2463 if (EFI_ERROR (Status)) {
2472 if (Question ==
NULL) {
2481 while (!
IsNull (&FormSet->FormListHead, Link)) {
2482 Form = FORM_BROWSER_FORM_FROM_LINK (Link);
2485 if (Question !=
NULL) {
2489 Link =
GetNextNode (&FormSet->FormListHead, Link);
2493 ASSERT (Form !=
NULL);
2498 Status =
GetQuestionValue (FormSet, Form, Question, GetSetValueWithEditBuffer);
2499 if (EFI_ERROR (Status)) {
2510 if (FormSet !=
NULL) {
2575 ASSERT (Expression !=
NULL);
2576 Expression->Result.Type = EFI_IFR_TYPE_OTHER;
2579 while (!
IsNull (&Expression->OpCodeListHead, Link)) {
2580 OpCode = EXPRESSION_OPCODE_FROM_LINK (Link);
2582 Link =
GetNextNode (&Expression->OpCodeListHead, Link);
2589 Value->Type = EFI_IFR_TYPE_BOOLEAN;
2592 switch (OpCode->Operand) {
2596 case EFI_IFR_EQ_ID_VAL_OP:
2597 Question =
IdToQuestion (FormSet, Form, OpCode->QuestionId);
2598 if (Question ==
NULL) {
2599 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2604 if (Status == EFI_UNSUPPORTED) {
2606 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2610 if (EFI_ERROR (Status)) {
2614 Value->Value.b = (BOOLEAN)((Result == 0) ?
TRUE :
FALSE);
2617 case EFI_IFR_EQ_ID_ID_OP:
2618 Question =
IdToQuestion (FormSet, Form, OpCode->QuestionId);
2619 if (Question ==
NULL) {
2620 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2624 Question2 =
IdToQuestion (FormSet, Form, OpCode->QuestionId2);
2625 if (Question2 ==
NULL) {
2626 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2630 Status =
CompareHiiValue (&Question->HiiValue, &Question2->HiiValue, &Result, FormSet->HiiHandle);
2631 if (Status == EFI_UNSUPPORTED) {
2632 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2637 if (EFI_ERROR (Status)) {
2641 Value->Value.b = (BOOLEAN)((Result == 0) ?
TRUE :
FALSE);
2644 case EFI_IFR_EQ_ID_VAL_LIST_OP:
2645 Question =
IdToQuestion (FormSet, Form, OpCode->QuestionId);
2646 if (Question ==
NULL) {
2647 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2651 Value->Value.b =
FALSE;
2652 for (Index = 0; Index < OpCode->ListLength; Index++) {
2653 if (Question->HiiValue.Value.u16 == OpCode->ValueList[Index]) {
2654 Value->Value.b =
TRUE;
2661 case EFI_IFR_DUP_OP:
2663 if (EFI_ERROR (Status)) {
2670 case EFI_IFR_QUESTION_REF1_OP:
2671 case EFI_IFR_THIS_OP:
2672 Question =
IdToQuestion (FormSet, Form, OpCode->QuestionId);
2673 if (Question ==
NULL) {
2674 Status = EFI_NOT_FOUND;
2678 Value = &Question->HiiValue;
2681 case EFI_IFR_SECURITY_OP:
2685 case EFI_IFR_GET_OP:
2689 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2690 Value->Value.u8 = 0;
2691 if (OpCode->VarStorage !=
NULL) {
2692 switch (OpCode->VarStorage->Type) {
2693 case EFI_HII_VARSTORE_BUFFER:
2694 case EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER:
2698 Value->Type = OpCode->ValueType;
2699 CopyMem (&Value->Value, OpCode->VarStorage->EditBuffer + OpCode->VarStoreInfo.VarOffset, OpCode->ValueWidth);
2701 case EFI_HII_VARSTORE_NAME_VALUE:
2702 if (OpCode->ValueType != EFI_IFR_TYPE_STRING) {
2706 Status =
GetValueByName (OpCode->VarStorage, OpCode->ValueName, &StrPtr, GetSetValueWithEditBuffer);
2707 if (!EFI_ERROR (Status)) {
2708 ASSERT (StrPtr !=
NULL);
2709 TempLength =
StrLen (StrPtr);
2710 if (OpCode->ValueWidth >= ((TempLength + 1) / 2)) {
2711 Value->Type = OpCode->ValueType;
2712 TempBuffer = (UINT8 *)&Value->Value;
2713 ZeroMem (TempStr,
sizeof (TempStr));
2714 for (Index = 0; Index < TempLength; Index++) {
2715 TempStr[0] = StrPtr[TempLength - Index - 1];
2717 if ((Index & 1) == 0) {
2718 TempBuffer[Index/2] = DigitUint8;
2720 TempBuffer[Index/2] = (UINT8)((DigitUint8 << 4) + TempBuffer[Index/2]);
2728 case EFI_HII_VARSTORE_EFI_VARIABLE:
2732 TempLength = OpCode->ValueWidth;
2733 Value->Type = OpCode->ValueType;
2734 Status =
gRT->GetVariable (
2736 &OpCode->VarStorage->Guid,
2741 if (EFI_ERROR (Status)) {
2742 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2743 Value->Value.u8 = 0;
2751 Status = EFI_UNSUPPORTED;
2758 if ((OpCode->ValueType != EFI_IFR_TYPE_DATE) && (OpCode->ValueType != EFI_IFR_TYPE_TIME)) {
2762 Status = EFI_UNSUPPORTED;
2766 Status =
gRT->GetTime (&EfiTime,
NULL);
2767 if (!EFI_ERROR (Status)) {
2768 if (OpCode->ValueType == EFI_IFR_TYPE_DATE) {
2769 switch (OpCode->VarStoreInfo.VarOffset) {
2771 Value->Type = EFI_IFR_TYPE_NUM_SIZE_16;
2772 Value->Value.u16 = EfiTime.Year;
2775 Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
2776 Value->Value.u8 = EfiTime.Month;
2779 Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
2780 Value->Value.u8 = EfiTime.Day;
2786 Status = EFI_INVALID_PARAMETER;
2790 switch (OpCode->VarStoreInfo.VarOffset) {
2792 Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
2793 Value->Value.u8 = EfiTime.Hour;
2796 Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
2797 Value->Value.u8 = EfiTime.Minute;
2800 Value->Type = EFI_IFR_TYPE_NUM_SIZE_8;
2801 Value->Value.u8 = EfiTime.Second;
2807 Status = EFI_INVALID_PARAMETER;
2816 case EFI_IFR_QUESTION_REF3_OP:
2822 if (EFI_ERROR (Status)) {
2829 if ((Value->Type > EFI_IFR_TYPE_NUM_SIZE_64) || (Value->Value.u64 > 0xffff)) {
2830 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2834 if (OpCode->DevicePath != 0) {
2835 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2837 StrPtr =
GetToken (OpCode->DevicePath, FormSet->HiiHandle);
2838 if ((StrPtr !=
NULL) && (mPathFromText !=
NULL)) {
2839 DevicePath = mPathFromText->ConvertTextToDevicePath (StrPtr);
2841 Value = &QuestionVal;
2844 if (DevicePath !=
NULL) {
2849 if (StrPtr !=
NULL) {
2854 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2858 Value = &QuestionVal;
2860 Question =
IdToQuestion (FormSet, Form, Value->Value.u16);
2861 if (Question ==
NULL) {
2862 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2869 Value = &Question->HiiValue;
2874 case EFI_IFR_RULE_REF_OP:
2879 if (RuleExpression ==
NULL) {
2880 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2888 if (EFI_ERROR (Status) || (RuleExpression->Result.Type == EFI_IFR_TYPE_UNDEFINED)) {
2889 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2893 Value = &RuleExpression->Result;
2896 case EFI_IFR_STRING_REF1_OP:
2897 Value->Type = EFI_IFR_TYPE_STRING;
2898 Value->Value.string = OpCode->Value.Value.
string;
2904 case EFI_IFR_TRUE_OP:
2905 case EFI_IFR_FALSE_OP:
2906 case EFI_IFR_ONE_OP:
2907 case EFI_IFR_ONES_OP:
2908 case EFI_IFR_UINT8_OP:
2909 case EFI_IFR_UINT16_OP:
2910 case EFI_IFR_UINT32_OP:
2911 case EFI_IFR_UINT64_OP:
2912 case EFI_IFR_UNDEFINED_OP:
2913 case EFI_IFR_VERSION_OP:
2914 case EFI_IFR_ZERO_OP:
2915 Value = &OpCode->Value;
2921 case EFI_IFR_LENGTH_OP:
2923 if (EFI_ERROR (Status)) {
2927 if ((Value->Type != EFI_IFR_TYPE_STRING) && !
IsTypeInBuffer (Value)) {
2928 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2932 if (Value->Type == EFI_IFR_TYPE_STRING) {
2933 StrPtr =
GetToken (Value->Value.string, FormSet->HiiHandle);
2934 if (StrPtr ==
NULL) {
2935 Status = EFI_INVALID_PARAMETER;
2939 Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
2940 Value->Value.u64 =
StrLen (StrPtr);
2943 Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
2950 case EFI_IFR_NOT_OP:
2952 if (EFI_ERROR (Status)) {
2956 if (Value->Type != EFI_IFR_TYPE_BOOLEAN) {
2957 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2961 Value->Value.b = (BOOLEAN)(!Value->Value.b);
2964 case EFI_IFR_QUESTION_REF2_OP:
2969 if (EFI_ERROR (Status)) {
2976 if ((Value->Type > EFI_IFR_TYPE_NUM_SIZE_64) || (Value->Value.u64 > 0xffff)) {
2977 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2981 Question =
IdToQuestion (FormSet, Form, Value->Value.u16);
2982 if (Question ==
NULL) {
2983 Value->Type = EFI_IFR_TYPE_UNDEFINED;
2987 Value = &Question->HiiValue;
2990 case EFI_IFR_STRING_REF2_OP:
2995 if (EFI_ERROR (Status)) {
3002 if ((Value->Type > EFI_IFR_TYPE_NUM_SIZE_64) || (Value->Value.u64 > 0xffff)) {
3003 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3007 Value->Type = EFI_IFR_TYPE_STRING;
3008 StrPtr =
GetToken (Value->Value.u16, FormSet->HiiHandle);
3009 if (StrPtr ==
NULL) {
3013 Value->Value.string =
NewString (gEmptyString, FormSet->HiiHandle);
3015 Index = (UINT16)Value->Value.u64;
3016 Value->Value.string = Index;
3022 case EFI_IFR_TO_BOOLEAN_OP:
3027 if (EFI_ERROR (Status)) {
3034 if (Value->Type <= EFI_IFR_TYPE_DATE) {
3041 Value->Type = EFI_IFR_TYPE_BOOLEAN;
3042 }
else if (Value->Type == EFI_IFR_TYPE_STRING) {
3048 StrPtr =
GetToken (Value->Value.string, FormSet->HiiHandle);
3049 if (StrPtr ==
NULL) {
3050 Status = EFI_INVALID_PARAMETER;
3055 if (
StrCmp (StrPtr, L
"TRUE") == 0) {
3056 Value->Value.b =
TRUE;
3057 Value->Type = EFI_IFR_TYPE_BOOLEAN;
3058 }
else if (
StrCmp (StrPtr, L
"FALSE") == 0) {
3059 Value->Value.b =
FALSE;
3060 Value->Type = EFI_IFR_TYPE_BOOLEAN;
3062 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3066 }
else if (Value->Type == EFI_IFR_TYPE_BUFFER) {
3071 for (Index = 0; Index < Value->BufferLen; Index++) {
3072 if (Value->Buffer[Index] != 0) {
3077 if (Index >= Value->BufferLen) {
3078 Value->Value.b =
FALSE;
3080 Value->Value.b =
TRUE;
3083 Value->Type = EFI_IFR_TYPE_BOOLEAN;
3089 case EFI_IFR_TO_STRING_OP:
3090 Status =
IfrToString (FormSet, OpCode->Format, Value);
3093 case EFI_IFR_TO_UINT_OP:
3097 case EFI_IFR_TO_LOWER_OP:
3098 case EFI_IFR_TO_UPPER_OP:
3100 if (EFI_ERROR (Status)) {
3105 if (EFI_ERROR (Status)) {
3109 if (Value->Type != EFI_IFR_TYPE_STRING) {
3110 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3114 StrPtr =
GetToken (Value->Value.string, FormSet->HiiHandle);
3115 if (StrPtr ==
NULL) {
3116 Status = EFI_NOT_FOUND;
3120 if (OpCode->Operand == EFI_IFR_TO_LOWER_OP) {
3121 mUnicodeCollation->StrLwr (mUnicodeCollation, StrPtr);
3123 mUnicodeCollation->StrUpr (mUnicodeCollation, StrPtr);
3126 Value->Value.string =
NewString (StrPtr, FormSet->HiiHandle);
3130 case EFI_IFR_BITWISE_NOT_OP:
3135 if (EFI_ERROR (Status)) {
3139 if (Value->Type > EFI_IFR_TYPE_DATE) {
3140 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3144 Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
3145 Value->Value.u64 = ~HiiValueToUINT64(Value);
3148 case EFI_IFR_SET_OP:
3153 if (EFI_ERROR (Status)) {
3157 Data1.Type = EFI_IFR_TYPE_BOOLEAN;
3158 Data1.Value.b =
FALSE;
3162 if (OpCode->VarStorage !=
NULL) {
3163 switch (OpCode->VarStorage->Type) {
3164 case EFI_HII_VARSTORE_BUFFER:
3165 case EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER:
3166 CopyMem (OpCode->VarStorage->EditBuffer + OpCode->VarStoreInfo.VarOffset, &Value->Value, OpCode->ValueWidth);
3167 Data1.Value.b =
TRUE;
3169 case EFI_HII_VARSTORE_NAME_VALUE:
3170 if (OpCode->ValueType != EFI_IFR_TYPE_STRING) {
3171 NameValue =
AllocateZeroPool ((OpCode->ValueWidth * 2 + 1) * sizeof (CHAR16));
3172 ASSERT (NameValue !=
NULL);
3176 TempBuffer = (UINT8 *)&Value->Value + OpCode->ValueWidth - 1;
3178 for (Index = 0; Index < OpCode->ValueWidth; Index++, TempBuffer--) {
3181 (OpCode->ValueWidth * 2 + 1) * sizeof (CHAR16) - ((
UINTN)StrPtr - (
UINTN)NameValue),
3182 PREFIX_ZERO | RADIX_HEX,
3186 StrPtr +=
StrnLenS (StrPtr, OpCode->ValueWidth * 2 + 1 - ((
UINTN)StrPtr - (
UINTN)NameValue) / sizeof (CHAR16));
3189 Status =
SetValueByName (OpCode->VarStorage, OpCode->ValueName, NameValue, GetSetValueWithEditBuffer,
NULL);
3191 if (!EFI_ERROR (Status)) {
3192 Data1.Value.b =
TRUE;
3197 case EFI_HII_VARSTORE_EFI_VARIABLE:
3198 Status =
gRT->SetVariable (
3200 &OpCode->VarStorage->Guid,
3201 OpCode->VarStorage->Attributes,
3205 if (!EFI_ERROR (Status)) {
3206 Data1.Value.b =
TRUE;
3214 Status = EFI_UNSUPPORTED;
3221 if ((OpCode->ValueType != EFI_IFR_TYPE_DATE) && (OpCode->ValueType != EFI_IFR_TYPE_TIME)) {
3225 Status = EFI_UNSUPPORTED;
3229 Status =
gRT->GetTime (&EfiTime,
NULL);
3230 if (!EFI_ERROR (Status)) {
3231 if (OpCode->ValueType == EFI_IFR_TYPE_DATE) {
3232 switch (OpCode->VarStoreInfo.VarOffset) {
3234 EfiTime.Year = Value->Value.u16;
3237 EfiTime.Month = Value->Value.u8;
3240 EfiTime.Day = Value->Value.u8;
3246 Status = EFI_INVALID_PARAMETER;
3250 switch (OpCode->VarStoreInfo.VarOffset) {
3252 EfiTime.Hour = Value->Value.u8;
3255 EfiTime.Minute = Value->Value.u8;
3258 EfiTime.Second = Value->Value.u8;
3264 Status = EFI_INVALID_PARAMETER;
3269 Status =
gRT->SetTime (&EfiTime);
3270 if (!EFI_ERROR (Status)) {
3271 Data1.Value.b =
TRUE;
3282 case EFI_IFR_ADD_OP:
3283 case EFI_IFR_SUBTRACT_OP:
3284 case EFI_IFR_MULTIPLY_OP:
3285 case EFI_IFR_DIVIDE_OP:
3286 case EFI_IFR_MODULO_OP:
3287 case EFI_IFR_BITWISE_AND_OP:
3288 case EFI_IFR_BITWISE_OR_OP:
3289 case EFI_IFR_SHIFT_LEFT_OP:
3290 case EFI_IFR_SHIFT_RIGHT_OP:
3295 if (EFI_ERROR (Status)) {
3303 if (EFI_ERROR (Status)) {
3307 if (Data2.Type > EFI_IFR_TYPE_DATE) {
3308 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3312 if (Data1.Type > EFI_IFR_TYPE_DATE) {
3313 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3317 Value->Type = EFI_IFR_TYPE_NUM_SIZE_64;
3319 switch (OpCode->Operand) {
3320 case EFI_IFR_ADD_OP:
3324 case EFI_IFR_SUBTRACT_OP:
3328 case EFI_IFR_MULTIPLY_OP:
3332 case EFI_IFR_DIVIDE_OP:
3336 case EFI_IFR_MODULO_OP:
3338 Value->Value.u64 = TempValue;
3341 case EFI_IFR_BITWISE_AND_OP:
3345 case EFI_IFR_BITWISE_OR_OP:
3349 case EFI_IFR_SHIFT_LEFT_OP:
3353 case EFI_IFR_SHIFT_RIGHT_OP:
3363 case EFI_IFR_AND_OP:
3369 if (EFI_ERROR (Status)) {
3377 if (EFI_ERROR (Status)) {
3381 if (Data2.Type != EFI_IFR_TYPE_BOOLEAN) {
3382 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3386 if (Data1.Type != EFI_IFR_TYPE_BOOLEAN) {
3387 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3391 if (OpCode->Operand == EFI_IFR_AND_OP) {
3392 Value->Value.b = (BOOLEAN)(Data1.Value.b && Data2.Value.b);
3394 Value->Value.b = (BOOLEAN)(Data1.Value.b || Data2.Value.b);
3399 case EFI_IFR_EQUAL_OP:
3400 case EFI_IFR_NOT_EQUAL_OP:
3401 case EFI_IFR_GREATER_EQUAL_OP:
3402 case EFI_IFR_GREATER_THAN_OP:
3403 case EFI_IFR_LESS_EQUAL_OP:
3404 case EFI_IFR_LESS_THAN_OP:
3409 if (EFI_ERROR (Status)) {
3417 if (EFI_ERROR (Status)) {
3421 if ((Data2.Type > EFI_IFR_TYPE_BOOLEAN) &&
3422 (Data2.Type != EFI_IFR_TYPE_STRING) &&
3425 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3429 if ((Data1.Type > EFI_IFR_TYPE_BOOLEAN) &&
3430 (Data1.Type != EFI_IFR_TYPE_STRING) &&
3433 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3437 Status =
CompareHiiValue (&Data1, &Data2, &Result, FormSet->HiiHandle);
3438 if (Data1.Type == EFI_IFR_TYPE_BUFFER) {
3442 if (Data2.Type == EFI_IFR_TYPE_BUFFER) {
3446 if (Status == EFI_UNSUPPORTED) {
3447 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3452 if (EFI_ERROR (Status)) {
3456 switch (OpCode->Operand) {
3457 case EFI_IFR_EQUAL_OP:
3458 Value->Value.b = (BOOLEAN)((Result == 0) ?
TRUE :
FALSE);
3461 case EFI_IFR_NOT_EQUAL_OP:
3462 Value->Value.b = (BOOLEAN)((Result != 0) ?
TRUE :
FALSE);
3465 case EFI_IFR_GREATER_EQUAL_OP:
3466 Value->Value.b = (BOOLEAN)((Result >= 0) ?
TRUE :
FALSE);
3469 case EFI_IFR_GREATER_THAN_OP:
3470 Value->Value.b = (BOOLEAN)((Result > 0) ?
TRUE :
FALSE);
3473 case EFI_IFR_LESS_EQUAL_OP:
3474 Value->Value.b = (BOOLEAN)((Result <= 0) ?
TRUE :
FALSE);
3477 case EFI_IFR_LESS_THAN_OP:
3478 Value->Value.b = (BOOLEAN)((Result < 0) ?
TRUE :
FALSE);
3487 case EFI_IFR_MATCH_OP:
3489 if (EFI_ERROR (Status)) {
3493 Status =
IfrMatch (FormSet, Value);
3496 case EFI_IFR_MATCH2_OP:
3497 Status =
IfrMatch2 (FormSet, &OpCode->Guid, Value);
3500 case EFI_IFR_CATENATE_OP:
3507 case EFI_IFR_CONDITIONAL_OP:
3512 if (EFI_ERROR (Status)) {
3520 if (EFI_ERROR (Status)) {
3528 if (EFI_ERROR (Status)) {
3532 if (Data1.Type != EFI_IFR_TYPE_BOOLEAN) {
3533 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3537 if (Data1.Value.b) {
3545 case EFI_IFR_FIND_OP:
3546 Status =
IfrFind (FormSet, OpCode->Format, Value);
3549 case EFI_IFR_MID_OP:
3550 Status =
IfrMid (FormSet, Value);
3553 case EFI_IFR_TOKEN_OP:
3554 Status =
IfrToken (FormSet, Value);
3557 case EFI_IFR_SPAN_OP:
3558 Status =
IfrSpan (FormSet, OpCode->Flags, Value);
3561 case EFI_IFR_MAP_OP:
3566 if (EFI_ERROR (Status)) {
3573 if (OpCode->MapExpressionList.ForwardLink ==
NULL) {
3574 Status = EFI_INVALID_PARAMETER;
3581 SubExpressionLink =
GetFirstNode (&OpCode->MapExpressionList);
3582 while (!
IsNull (&OpCode->MapExpressionList, SubExpressionLink)) {
3583 SubExpression = FORM_EXPRESSION_FROM_LINK (SubExpressionLink);
3588 if (EFI_ERROR (Status)) {
3599 SubExpressionLink =
GetNextNode (&OpCode->MapExpressionList, SubExpressionLink);
3600 if (
IsNull (&OpCode->MapExpressionList, SubExpressionLink)) {
3601 Status = EFI_INVALID_PARAMETER;
3605 SubExpression = FORM_EXPRESSION_FROM_LINK (SubExpressionLink);
3607 if (EFI_ERROR (Status)) {
3611 Value = &SubExpression->Result;
3618 SubExpressionLink =
GetNextNode (&OpCode->MapExpressionList, SubExpressionLink);
3619 if (
IsNull (&OpCode->MapExpressionList, SubExpressionLink)) {
3620 Status = EFI_INVALID_PARAMETER;
3627 SubExpressionLink =
GetNextNode (&OpCode->MapExpressionList, SubExpressionLink);
3633 if (
IsNull (&OpCode->MapExpressionList, SubExpressionLink)) {
3634 Value->Type = EFI_IFR_TYPE_UNDEFINED;
3635 Value->Value.u8 = 0;
3644 if (EFI_ERROR (Status) || (Value->Type == EFI_IFR_TYPE_UNDEFINED)) {
3649 if (EFI_ERROR (Status)) {
3659 if (EFI_ERROR (Status)) {
3667 Status = EFI_INVALID_PARAMETER;
3672 if (!EFI_ERROR (Status)) {
3696 switch (Result->Type) {
3697 case EFI_IFR_TYPE_BOOLEAN:
3698 return Result->Value.b;
3700 case EFI_IFR_TYPE_NUM_SIZE_8:
3701 return (BOOLEAN)(Result->Value.u8 != 0);
3703 case EFI_IFR_TYPE_NUM_SIZE_16:
3704 return (BOOLEAN)(Result->Value.u16 != 0);
3706 case EFI_IFR_TYPE_NUM_SIZE_32:
3707 return (BOOLEAN)(Result->Value.u32 != 0);
3709 case EFI_IFR_TYPE_NUM_SIZE_64:
3710 return (BOOLEAN)(Result->Value.u64 != 0);
3734 IN BOOLEAN Evaluate,
3740 EXPRESS_RESULT ReturnVal;
3741 EXPRESS_RESULT CompareOne;
3744 if (ExpList ==
NULL) {
3745 return ExpressFalse;
3748 ASSERT (ExpList->Signature == FORM_EXPRESSION_LIST_SIGNATURE);
3755 while (ExpList->Count > Index) {
3757 if (EFI_ERROR (Status)) {
3758 return ExpressFalse;
3766 ReturnVal = ExpressFalse;
3767 for (Index = 0; Index < ExpList->Count; Index++) {
3768 if (
IsTrue (&ExpList->Expression[Index]->Result)) {
3769 switch (ExpList->Expression[Index]->Type) {
3770 case EFI_HII_EXPRESSION_SUPPRESS_IF:
3771 CompareOne = ExpressSuppress;
3774 case EFI_HII_EXPRESSION_GRAY_OUT_IF:
3775 CompareOne = ExpressGrayOut;
3778 case EFI_HII_EXPRESSION_DISABLE_IF:
3779 CompareOne = ExpressDisable;
3783 return ExpressFalse;
3786 ReturnVal = ReturnVal < CompareOne ? CompareOne : ReturnVal;
UINT64 EFIAPI StrHexToUint64(IN CONST CHAR16 *String)
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
UINT64 EFIAPI DivU64x32(IN UINT64 Dividend, IN UINT32 Divisor)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
UINT64 EFIAPI StrDecimalToUint64(IN CONST CHAR16 *String)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
RETURN_STATUS EFIAPI StrCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
UINTN EFIAPI StrnLenS(IN CONST CHAR16 *String, IN UINTN MaxSize)
UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count)
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
UINT64 EFIAPI DivU64x32Remainder(IN UINT64 Dividend, IN UINT32 Divisor, OUT UINT32 *Remainder OPTIONAL)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
BOOLEAN EFIAPI IsZeroGuid(IN CONST GUID *Guid)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
BOOLEAN GetQuestionValueFromForm(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN EFI_HII_HANDLE InputHiiHandle, IN EFI_GUID *FormSetGuid, IN EFI_QUESTION_ID QuestionId, OUT EFI_HII_VALUE *Value)
EFI_STATUS IfrMid(IN FORM_BROWSER_FORMSET *FormSet, OUT EFI_HII_VALUE *Result)
EFI_STATUS CompareHiiValue(IN EFI_HII_VALUE *Value1, IN EFI_HII_VALUE *Value2, OUT INTN *Result, IN EFI_HII_HANDLE HiiHandle OPTIONAL)
EFI_STATUS GrowConditionalStack(IN OUT FORM_EXPRESSION ***Stack, IN OUT FORM_EXPRESSION ***StackPtr, IN OUT FORM_EXPRESSION ***StackEnd, IN UINTN MemberSize)
EFI_STATUS IfrMatch(IN FORM_BROWSER_FORMSET *FormSet, OUT EFI_HII_VALUE *Result)
EFI_STATUS EvaluateExpression(IN FORM_BROWSER_FORMSET *FormSet, IN FORM_BROWSER_FORM *Form, IN OUT FORM_EXPRESSION *Expression)
EFI_STATUS PopMapExpressionList(OUT VOID **Pointer)
VOID ResetScopeStack(VOID)
EXPRESS_RESULT EvaluateExpressionList(IN FORM_EXPRESSION_LIST *ExpList, IN BOOLEAN Evaluate, IN FORM_BROWSER_FORMSET *FormSet OPTIONAL, IN FORM_BROWSER_FORM *Form OPTIONAL)
VOID ExtendValueToU64(IN EFI_HII_VALUE *Value)
EFI_STATUS PushConditionalStack(IN OUT FORM_EXPRESSION ***Stack, IN OUT FORM_EXPRESSION ***StackPtr, IN OUT FORM_EXPRESSION ***StackEnd, IN FORM_EXPRESSION **Data)
UINT8 * GetBufferForValue(IN EFI_HII_VALUE *Value)
EFI_STATUS IfrMatch2(IN FORM_BROWSER_FORMSET *FormSet, IN EFI_GUID *SyntaxType, OUT EFI_HII_VALUE *Result)
VOID RestoreExpressionEvaluationStackOffset(UINTN StackOffset)
EFI_STATUS PushCurrentExpression(IN VOID *Pointer)
VOID ResetCurrentExpressionStack(VOID)
EFI_STATUS PopExpression(OUT EFI_HII_VALUE *Value)
EFI_STATUS PushStack(IN OUT EFI_HII_VALUE **Stack, IN OUT EFI_HII_VALUE **StackPtr, IN OUT EFI_HII_VALUE **StackEnd, IN EFI_HII_VALUE *Data)
BOOLEAN IsTypeInUINT64(IN EFI_HII_VALUE *Value)
EFI_STATUS PushConditionalExpression(IN FORM_EXPRESSION *Pointer, IN EXPRESS_LEVEL Level)
EFI_STATUS PushScope(IN UINT8 Operand)
FORM_BROWSER_FORM * IdToForm(IN FORM_BROWSER_FORMSET *FormSet, IN UINT16 FormId)
UINT64 HiiValueToUINT64(IN EFI_HII_VALUE *Value)
EFI_STATUS IfrToken(IN FORM_BROWSER_FORMSET *FormSet, OUT EFI_HII_VALUE *Result)
EFI_STATUS IfrFind(IN FORM_BROWSER_FORMSET *FormSet, IN UINT8 Format, OUT EFI_HII_VALUE *Result)
FORM_BROWSER_STATEMENT * IdToQuestion(IN FORM_BROWSER_FORMSET *FormSet, IN FORM_BROWSER_FORM *Form, IN UINT16 QuestionId)
EFI_STATUS IfrToString(IN FORM_BROWSER_FORMSET *FormSet, IN UINT8 Format, OUT EFI_HII_VALUE *Result)
BOOLEAN CheckUserPrivilege(IN EFI_GUID *Guid)
BOOLEAN IsTypeInBuffer(IN EFI_HII_VALUE *Value)
EFI_STATUS IfrCatenate(IN FORM_BROWSER_FORMSET *FormSet, OUT EFI_HII_VALUE *Result)
EFI_STATUS IfrToUint(IN FORM_BROWSER_FORMSET *FormSet, OUT EFI_HII_VALUE *Result)
FORM_EXPRESSION * RuleIdToExpression(IN FORM_BROWSER_FORM *Form, IN UINT8 RuleId)
EFI_STATUS IfrSpan(IN FORM_BROWSER_FORMSET *FormSet, IN UINT8 Flags, OUT EFI_HII_VALUE *Result)
EFI_STATUS PopConditionalExpression(IN EXPRESS_LEVEL Level)
INTN GetConditionalExpressionCount(IN EXPRESS_LEVEL Level)
EFI_STATUS PopCurrentExpression(OUT VOID **Pointer)
VOID IfrStrToUpper(IN CHAR16 *String)
EFI_STATUS PushMapExpressionList(IN VOID *Pointer)
EFI_STATUS GrowStack(IN OUT EFI_HII_VALUE **Stack, IN OUT EFI_HII_VALUE **StackPtr, IN OUT EFI_HII_VALUE **StackEnd)
EFI_STATUS PopScope(OUT UINT8 *Operand)
FORM_EXPRESSION ** GetConditionalExpressionList(IN EXPRESS_LEVEL Level)
EFI_STATUS PopConditionalStack(IN FORM_EXPRESSION **Stack, IN OUT FORM_EXPRESSION ***StackPtr, OUT FORM_EXPRESSION **Data)
EFI_STATUS InitializeUnicodeCollationProtocol(VOID)
EFI_STATUS PushExpression(IN EFI_HII_VALUE *Value)
VOID ResetMapExpressionListStack(VOID)
UINT16 GetLengthForValue(IN EFI_HII_VALUE *Value)
FORM_BROWSER_STATEMENT * IdToQuestion2(IN FORM_BROWSER_FORM *Form, IN UINT16 QuestionId)
BOOLEAN IsTrue(IN EFI_HII_VALUE *Result)
UINTN SaveExpressionEvaluationStackOffset(VOID)
EFI_STATUS PopStack(IN EFI_HII_VALUE *Stack, IN OUT EFI_HII_VALUE **StackPtr, OUT EFI_HII_VALUE *Data)
VOID DestroyFormSet(IN OUT FORM_BROWSER_FORMSET *FormSet)
RETURN_STATUS EFIAPI UnicodeValueToStringS(IN OUT CHAR16 *Buffer, IN UINTN BufferSize, IN UINTN Flags, IN INT64 Value, IN UINTN Width)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
#define ASSERT_EFI_ERROR(StatusParameter)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_HII_HANDLE DevicePathToHiiHandle(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN EFI_GUID *FormsetGuid)
#define MAXIMUM_VALUE_CHARACTERS
EFI_STATUS SetValueByName(IN BROWSER_STORAGE *Storage, IN CHAR16 *Name, IN CHAR16 *Value, IN GET_SET_QUESTION_VALUE_WITH SetValueTo, OUT NAME_VALUE_NODE **ReturnNode)
EFI_STATUS InitializeFormSet(IN EFI_HII_HANDLE Handle, IN OUT EFI_GUID *FormSetGuid, OUT FORM_BROWSER_FORMSET *FormSet)
EFI_STATUS GetValueByName(IN BROWSER_STORAGE *Storage, IN CHAR16 *Name, IN OUT CHAR16 **Value, IN GET_SET_QUESTION_VALUE_WITH GetValueFrom)
EFI_STATUS GetQuestionValue(IN FORM_BROWSER_FORMSET *FormSet, IN FORM_BROWSER_FORM *Form, IN OUT FORM_BROWSER_STATEMENT *Question, IN GET_SET_QUESTION_VALUE_WITH GetValueFrom)
EFI_STRING_ID NewString(IN CHAR16 *String, IN EFI_HII_HANDLE HiiHandle)
#define EFI_USER_INFO_ACCESS_SETUP
#define EFI_USER_INFO_ACCESS_POLICY_RECORD
UINT32 Size
Specifies the size of the user access control record, in bytes, including this header.
UINT32 Type
Specifies the type of user access control.
EFI_STRING_ID string
EFI_IFR_TYPE_STRING, EFI_IFR_TYPE_ACTION.