return EFI_INVALID_PARAMETER;\r
}\r
\r
- if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
\r
Status = EFI_SUCCESS;\r
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);\r
break;\r
\r
case 0x2000:\r
+ //\r
+ // Only used to update the state.\r
+ //\r
+ if ((Type == EFI_IFR_TYPE_STRING) && (Value->string == 0) && \r
+ (PrivateData->PasswordState == BROWSER_STATE_SET_PASSWORD)) {\r
+ PrivateData->PasswordState = BROWSER_STATE_VALIDATE_PASSWORD;\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
//\r
// When try to set a new password, user will be chanlleged with old password.\r
// The Callback is responsible for validating old password input by user,\r
key = 0x1236,\r
minsize = 6,\r
maxsize = 40,\r
+ inconsistentif prompt = STRING_TOKEN(STR_STRING_CHECK_ERROR_POPUP),\r
+ pushthis != stringref(STRING_TOKEN(STR_STRING_CHECK))\r
+ endif\r
endstring;\r
\r
//\r
/**\r
Free resources of a Statement.\r
\r
+ @param FormSet Pointer of the FormSet\r
@param Statement Pointer of the Statement\r
\r
**/\r
VOID\r
DestroyStatement (\r
+ IN FORM_BROWSER_FORMSET *FormSet,\r
IN OUT FORM_BROWSER_STATEMENT *Statement\r
)\r
{\r
if (Statement->BufferValue != NULL) {\r
FreePool (Statement->BufferValue);\r
}\r
+ if (Statement->Operand == EFI_IFR_STRING_OP || Statement->Operand == EFI_IFR_PASSWORD_OP) {\r
+ DeleteString(Statement->HiiValue.Value.string, FormSet->HiiHandle);\r
+ }\r
}\r
\r
\r
/**\r
Free resources of a Form.\r
\r
+ @param FormSet Pointer of the FormSet\r
@param Form Pointer of the Form.\r
\r
**/\r
VOID\r
DestroyForm (\r
- IN OUT FORM_BROWSER_FORM *Form\r
+ IN FORM_BROWSER_FORMSET *FormSet,\r
+ IN OUT FORM_BROWSER_FORM *Form\r
)\r
{\r
LIST_ENTRY *Link;\r
Statement = FORM_BROWSER_STATEMENT_FROM_LINK (Link);\r
RemoveEntryList (&Statement->Link);\r
\r
- DestroyStatement (Statement);\r
+ DestroyStatement (FormSet, Statement);\r
}\r
\r
//\r
Form = FORM_BROWSER_FORM_FROM_LINK (Link);\r
RemoveEntryList (&Form->Link);\r
\r
- DestroyForm (Form);\r
+ DestroyForm (FormSet, Form);\r
}\r
}\r
\r
\r
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_STRING;\r
CurrentStatement->BufferValue = AllocateZeroPool (CurrentStatement->StorageWidth + sizeof (CHAR16));\r
+ CurrentStatement->HiiValue.Value.string = NewString ((CHAR16*) CurrentStatement->BufferValue, FormSet->HiiHandle);\r
\r
InitializeRequestElement (FormSet, CurrentStatement);\r
break;\r
\r
CurrentStatement->HiiValue.Type = EFI_IFR_TYPE_STRING;\r
CurrentStatement->BufferValue = AllocateZeroPool ((CurrentStatement->StorageWidth + sizeof (CHAR16)));\r
+ CurrentStatement->HiiValue.Value.string = NewString ((CHAR16*) CurrentStatement->BufferValue, FormSet->HiiHandle);\r
\r
InitializeRequestElement (FormSet, CurrentStatement);\r
break;\r
\r
HiiValue = &Statement->HiiValue;\r
TypeValue = &HiiValue->Value;\r
- if (HiiValue->Type == EFI_IFR_TYPE_STRING) {\r
- //\r
- // Create String in HII database for Configuration Driver to retrieve\r
- //\r
- HiiValue->Value.string = NewString ((CHAR16 *) Statement->BufferValue, Selection->FormSet->HiiHandle);\r
- } else if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {\r
+ if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {\r
//\r
// For OrderedList, passing in the value buffer to Callback()\r
//\r
&ActionRequest\r
);\r
\r
- if (HiiValue->Type == EFI_IFR_TYPE_STRING) {\r
- //\r
- // Clean the String in HII Database\r
- //\r
- DeleteString (HiiValue->Value.string, Selection->FormSet->HiiHandle);\r
- }\r
-\r
if (!EFI_ERROR (Status)) {\r
switch (ActionRequest) {\r
case EFI_BROWSER_ACTION_REQUEST_RESET:\r
EFI_STATUS Status;\r
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
EFI_BROWSER_ACTION_REQUEST ActionRequest;\r
- EFI_HII_VALUE *QuestionValue;\r
+ EFI_IFR_TYPE_VALUE IfrTypeValue;\r
\r
- QuestionValue = &MenuOption->ThisTag->HiiValue;\r
ConfigAccess = Selection->FormSet->ConfigAccess;\r
if (ConfigAccess == NULL) {\r
return EFI_UNSUPPORTED;\r
// Prepare password string in HII database\r
//\r
if (String != NULL) {\r
- QuestionValue->Value.string = NewString (String, Selection->FormSet->HiiHandle);\r
+ IfrTypeValue.string = NewString (String, Selection->FormSet->HiiHandle);\r
} else {\r
- QuestionValue->Value.string = 0;\r
+ IfrTypeValue.string = 0;\r
}\r
\r
//\r
ConfigAccess,\r
EFI_BROWSER_ACTION_CHANGING,\r
MenuOption->ThisTag->QuestionId,\r
- QuestionValue->Type,\r
- &QuestionValue->Value,\r
+ MenuOption->ThisTag->HiiValue.Type,\r
+ &IfrTypeValue,\r
&ActionRequest\r
);\r
\r
// Remove password string from HII database\r
//\r
if (String != NULL) {\r
- DeleteString (QuestionValue->Value.string, Selection->FormSet->HiiHandle);\r
+ DeleteString (IfrTypeValue.string, Selection->FormSet->HiiHandle);\r
}\r
\r
return Status;\r
UINTN Index2;\r
UINT8 *ValueArray;\r
UINT8 ValueType;\r
+ EFI_STRING_ID StringId;\r
\r
Status = EFI_SUCCESS;\r
\r
StringPtr = NULL;\r
Character[1] = L'\0';\r
*OptionString = NULL;\r
+ StringId = 0;\r
\r
ZeroMem (FormattedNumber, 21 * sizeof (CHAR16));\r
BufferSize = (gOptionBlockWidth + 1) * 2 * gScreenDimensions.BottomRow;\r
\r
Status = ReadString (MenuOption, gPromptForData, StringPtr);\r
if (!EFI_ERROR (Status)) {\r
- CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));\r
- SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);\r
+ HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, StringPtr, NULL);\r
+ Status = ValidateQuestion(Selection->FormSet, Selection->Form, Question, EFI_HII_EXPRESSION_INCONSISTENT_IF);\r
+ if (EFI_ERROR (Status)) {\r
+ HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, (CHAR16*)Question->BufferValue, NULL);\r
+ } else {\r
+ CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));\r
+ SetQuestionValue (Selection->FormSet, Selection->Form, Question, TRUE);\r
\r
- UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
+ UpdateStatusBar (NV_UPDATE_REQUIRED, Question->QuestionFlags, TRUE);\r
+ }\r
}\r
\r
FreePool (StringPtr);\r
//\r
if (StrCmp (StringPtr, TempString) == 0) {\r
//\r
- // Two password match, send it to Configuration Driver\r
+ // Prepare the Question->HiiValue.Value.string for ValidateQuestion use.\r
//\r
- if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
- PasswordCallback (Selection, MenuOption, StringPtr);\r
+ if((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
+ StringId = Question->HiiValue.Value.string;\r
+ Question->HiiValue.Value.string = NewString (StringPtr, Selection->FormSet->HiiHandle);\r
} else {\r
- CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));\r
- SetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);\r
+ HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, StringPtr, NULL);\r
+ }\r
+ \r
+ Status = ValidateQuestion(Selection->FormSet, Selection->Form, Question, EFI_HII_EXPRESSION_INCONSISTENT_IF);\r
+\r
+ //\r
+ // Researve the Question->HiiValue.Value.string.\r
+ //\r
+ if((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
+ DeleteString(Question->HiiValue.Value.string, Selection->FormSet->HiiHandle);\r
+ Question->HiiValue.Value.string = StringId;\r
+ } \r
+ \r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // Reset state machine for interactive password\r
+ //\r
+ if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
+ PasswordCallback (Selection, MenuOption, NULL);\r
+ } else {\r
+ //\r
+ // Researve the Question->HiiValue.Value.string.\r
+ //\r
+ HiiSetString(Selection->FormSet->HiiHandle, Question->HiiValue.Value.string, (CHAR16*)Question->BufferValue, NULL); \r
+ }\r
+ } else {\r
+ //\r
+ // Two password match, send it to Configuration Driver\r
+ //\r
+ if ((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) {\r
+ PasswordCallback (Selection, MenuOption, StringPtr);\r
+ } else {\r
+ CopyMem (Question->BufferValue, StringPtr, Maximum * sizeof (CHAR16));\r
+ SetQuestionValue (Selection->FormSet, Selection->Form, Question, FALSE);\r
+ }\r
}\r
} else {\r
//\r
if (EFI_ERROR (Status)) {\r
return Status;\r
}\r
- \r
+\r
+ if ((Question->Operand == EFI_IFR_STRING_OP) || (Question->Operand == EFI_IFR_PASSWORD_OP)) {\r
+ HiiSetString (FormSet->HiiHandle, Question->HiiValue.Value.string, (CHAR16*)Question->BufferValue, NULL);\r
+ }\r
+\r
//\r
// Check whether EfiVarstore with CallBack can be got.\r
//\r
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
HiiValue = &Question->HiiValue;\r
BufferValue = (UINT8 *) &Question->HiiValue.Value;\r
- if (HiiValue->Type == EFI_IFR_TYPE_STRING) {\r
- //\r
- // Create String in HII database for Configuration Driver to retrieve\r
- //\r
- HiiValue->Value.string = NewString ((CHAR16 *) Question->BufferValue, FormSet->HiiHandle);\r
- } else if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {\r
+ if (HiiValue->Type == EFI_IFR_TYPE_BUFFER) {\r
BufferValue = Question->BufferValue;\r
}\r
\r
(EFI_IFR_TYPE_VALUE *) BufferValue,\r
&ActionRequest\r
);\r
-\r
- if (HiiValue->Type == EFI_IFR_TYPE_STRING) {\r
- //\r
- // Clean the String in HII Database\r
- //\r
- DeleteString (HiiValue->Value.string, FormSet->HiiHandle);\r
- }\r
-\r
if (!EFI_ERROR (Status)) {\r
switch (ActionRequest) {\r
case EFI_BROWSER_ACTION_REQUEST_RESET:\r
UI_MENU_SELECTION *Selection;\r
FORM_BROWSER_STATEMENT *Question;\r
EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
- EFI_HII_VALUE *HiiValue;\r
EFI_BROWSER_ACTION_REQUEST ActionRequest;\r
\r
if (gMenuRefreshHead != NULL) {\r
ConfigAccess = Selection->FormSet->ConfigAccess;\r
if (((Question->QuestionFlags & EFI_IFR_FLAG_CALLBACK) != 0) && (ConfigAccess != NULL)) {\r
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
-\r
- HiiValue = &Question->HiiValue;\r
- if (HiiValue->Type == EFI_IFR_TYPE_STRING) {\r
- //\r
- // Create String in HII database for Configuration Driver to retrieve\r
- //\r
- HiiValue->Value.string = NewString ((CHAR16 *) Question->BufferValue, Selection->FormSet->HiiHandle);\r
- }\r
-\r
Status = ConfigAccess->Callback (\r
ConfigAccess,\r
EFI_BROWSER_ACTION_CHANGING,\r
Question->QuestionId,\r
- HiiValue->Type,\r
- &HiiValue->Value,\r
+ Question->HiiValue.Type,\r
+ &Question->HiiValue.Value,\r
&ActionRequest\r
);\r
-\r
- if (HiiValue->Type == EFI_IFR_TYPE_STRING) {\r
- //\r
- // Clean the String in HII Database\r
- //\r
- DeleteString (HiiValue->Value.string, Selection->FormSet->HiiHandle);\r
- }\r
-\r
if (!EFI_ERROR (Status)) {\r
switch (ActionRequest) {\r
case EFI_BROWSER_ACTION_REQUEST_RESET:\r