/* This function checks VarOffset and VarWidth is in the block range. */
BOOLEAN BlockArrayCheck(IN IFR_BLOCK_DATA *RequestBlockArray, IN UINT16 VarOffset, IN UINT16 VarWidth, IN BOOLEAN IsNameValueType, IN EFI_HII_HANDLE HiiHandle)
/* This function checks VarOffset and VarWidth is in the block range. */
BOOLEAN BlockArrayCheck(IN IFR_BLOCK_DATA *RequestBlockArray, IN UINT16 VarOffset, IN UINT16 VarWidth, IN BOOLEAN IsNameValueType, IN EFI_HII_HANDLE HiiHandle)
{
  LIST_ENTRY      *Link;
  IFR_BLOCK_DATA  *BlockData;
  EFI_STRING      Name;
  if (RequestBlockArray == NULL) {
    return TRUE;
  }
  for (Link = RequestBlockArray->Entry.ForwardLink; Link != &RequestBlockArray->Entry; Link = Link->ForwardLink) {
    BlockData = BASE_CR (Link, IFR_BLOCK_DATA, Entry);
    if (IsNameValueType) {
      Name = InternalGetString (HiiHandle, VarOffset);
      ASSERT (Name != NULL);
      if (StrnCmp (BlockData->Name, Name, StrLen (Name)) == 0) {
        FreePool (Name);
        return TRUE;
      }
      FreePool (Name);
    } else {
      if ((VarOffset >= BlockData->Offset) && ((VarOffset + VarWidth) <= (BlockData->Offset + BlockData->Width))) {
        return TRUE;
      }
    }
  }
  return FALSE;
}