Default = QUESTION_DEFAULT_FROM_LINK (Link);\r
RemoveEntryList (&Default->Link);\r
\r
+ if (Default->Value.Buffer != NULL) {\r
+ FreePool (Default->Value.Buffer);\r
+ }\r
FreePool (Default);\r
}\r
\r
\r
CurrentDefault->Value.Type = ((EFI_IFR_DEFAULT *) OpCodeData)->Type;\r
CopyMem (&CurrentDefault->DefaultId, &((EFI_IFR_DEFAULT *) OpCodeData)->DefaultId, sizeof (UINT16));\r
- if (OpCodeLength > OFFSET_OF (EFI_IFR_DEFAULT, Value)) {\r
+ if (CurrentDefault->Value.Type == EFI_IFR_TYPE_BUFFER) {\r
+ CurrentDefault->Value.BufferLen = (UINT16) (OpCodeLength - OFFSET_OF (EFI_IFR_DEFAULT, Value));\r
+ CurrentDefault->Value.Buffer = AllocateCopyPool (CurrentDefault->Value.BufferLen, &((EFI_IFR_DEFAULT *) OpCodeData)->Value);\r
+ ASSERT (CurrentDefault->Value.Buffer != NULL);\r
+ } else {\r
CopyMem (&CurrentDefault->Value.Value, &((EFI_IFR_DEFAULT *) OpCodeData)->Value, OpCodeLength - OFFSET_OF (EFI_IFR_DEFAULT, Value));\r
ExtendValueToU64 (&CurrentDefault->Value);\r
}\r
// Option\r
//\r
case EFI_IFR_ONE_OF_OPTION_OP:\r
+ if (ParentStatement->Operand == EFI_IFR_ORDERED_LIST_OP && ((((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Flags & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG)) != 0)) {\r
+ //\r
+ // It's keep the default value for ordered list opcode.\r
+ //\r
+ CurrentDefault = AllocateZeroPool (sizeof (QUESTION_DEFAULT));\r
+ ASSERT (CurrentDefault != NULL);\r
+ CurrentDefault->Signature = QUESTION_DEFAULT_SIGNATURE;\r
+\r
+ CurrentDefault->Value.Type = EFI_IFR_TYPE_BUFFER;\r
+ if ((((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Flags & EFI_IFR_OPTION_DEFAULT) != 0) {\r
+ CurrentDefault->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;\r
+ } else {\r
+ CurrentDefault->DefaultId = EFI_HII_DEFAULT_CLASS_MANUFACTURING;\r
+ }\r
+\r
+ CurrentDefault->Value.BufferLen = (UINT16) (OpCodeLength - OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value));\r
+ CurrentDefault->Value.Buffer = AllocateCopyPool (CurrentDefault->Value.BufferLen, &((EFI_IFR_ONE_OF_OPTION *) OpCodeData)->Value);\r
+ ASSERT (CurrentDefault->Value.Buffer != NULL);\r
+\r
+ //\r
+ // Insert to Default Value list of current Question\r
+ //\r
+ InsertTailList (&ParentStatement->DefaultListHead, &CurrentDefault->Link);\r
+ break;\r
+ }\r
+\r
//\r
// EFI_IFR_ONE_OF_OPTION appear in scope of a Question.\r
// It create a selection for use in current Question.\r
//\r
// Default value is embedded in EFI_IFR_DEFAULT\r
//\r
- CopyMem (HiiValue, &Default->Value, sizeof (EFI_HII_VALUE));\r
+ if (Default->Value.Type == EFI_IFR_TYPE_BUFFER) {\r
+ ASSERT (HiiValue->Buffer != NULL);\r
+ CopyMem (HiiValue->Buffer, Default->Value.Buffer, Default->Value.BufferLen);\r
+ } else {\r
+ CopyMem (HiiValue, &Default->Value, sizeof (EFI_HII_VALUE));\r
+ }\r
}\r
\r
if (HiiValue->Type == EFI_IFR_TYPE_STRING) {\r