/* Set Value of given Name in a NameValue Storage. */
EFI_STATUS SetValueByName(IN HII_FORMSET_STORAGE *Storage, IN CHAR16 *Name, IN CHAR16 *Value, OUT HII_NAME_VALUE_NODE **ReturnNode)
/* Set Value of given Name in a NameValue Storage. */
EFI_STATUS SetValueByName(IN HII_FORMSET_STORAGE *Storage, IN CHAR16 *Name, IN CHAR16 *Value, OUT HII_NAME_VALUE_NODE **ReturnNode)
{
  LIST_ENTRY           *Link;
  HII_NAME_VALUE_NODE  *Node;
  CHAR16               *Buffer;
  Link = GetFirstNode (&Storage->NameValueList);
  while (!IsNull (&Storage->NameValueList, Link)) {
    Node = HII_NAME_VALUE_NODE_FROM_LINK (Link);
    if (StrCmp (Name, Node->Name) == 0) {
      Buffer = Node->Value;
      if (Buffer != NULL) {
        FreePool (Buffer);
      }
      Buffer = AllocateCopyPool (StrSize (Value), Value);
      if (Buffer == NULL) {
        return EFI_OUT_OF_RESOURCES;
      }
      Node->Value = Buffer;
      if (ReturnNode != NULL) {
        *ReturnNode = Node;
      }
      return EFI_SUCCESS;
    }
    Link = GetNextNode (&Storage->NameValueList, Link);
  }
  return EFI_NOT_FOUND;
}