/* Find the matched variable from the input variable storage. */
VARIABLE_HEADER* FindVariableData(IN VARIABLE_STORE_HEADER *VariableStorage, IN EFI_GUID *VarGuid, IN UINT32 VarAttribute, IN CHAR16 *VarName)
/* Find the matched variable from the input variable storage. */
VARIABLE_HEADER* FindVariableData(IN VARIABLE_STORE_HEADER *VariableStorage, IN EFI_GUID *VarGuid, IN UINT32 VarAttribute, IN CHAR16 *VarName)
{
  VARIABLE_HEADER  *VariableHeader;
  VARIABLE_HEADER  *VariableEnd;
  VariableEnd    = (VARIABLE_HEADER *)((UINT8 *)VariableStorage + VariableStorage->Size);
  VariableHeader = (VARIABLE_HEADER *)(VariableStorage + 1);
  VariableHeader = (VARIABLE_HEADER *)HEADER_ALIGN (VariableHeader);
  while (VariableHeader < VariableEnd) {
    if (CompareGuid (&VariableHeader->VendorGuid, VarGuid) &&
        (VariableHeader->Attributes == VarAttribute) &&
        (StrCmp (VarName, (CHAR16 *)(VariableHeader + 1)) == 0))
    {
      return VariableHeader;
    }
    VariableHeader = (VARIABLE_HEADER *)((UINT8 *)VariableHeader + sizeof (VARIABLE_HEADER) + VariableHeader->NameSize + VariableHeader->DataSize);
    VariableHeader = (VARIABLE_HEADER *)HEADER_ALIGN (VariableHeader);
  }
  return NULL;
}