BiGetElement

INT64 __fastcall BiGetElement(VOID *ObjectHandle, UINT64 Type, VOID **Element, UINT64 *ElementSize){
  void *PoolWithTag; 
  unsigned int v7; 
  int ElementDataWithFlags; 
  UINT64 v10; 
  SIZE_T NumberOfBytes; 
  PoolWithTag = 0i64;
  LODWORD(NumberOfBytes) = 0;
  *(_DWORD *)ElementSize = 0;
  *Element = 0i64;
  v7 = Type;
  ElementDataWithFlags = BcdGetElementDataWithFlags(ObjectHandle, Type, (UINT64)Element, 0i64, &NumberOfBytes);
  if( ElementDataWithFlags != -1073741789 )
  {
LABEL_6:
    if( ElementDataWithFlags >= 0 )
      return(unsigned int)ElementDataWithFlags;
    goto LABEL_7;
  }
  PoolWithTag = ExAllocatePoolWithTag(PagedPool, (unsigned int)NumberOfBytes, 0x4B444342ui64);
  if( !PoolWithTag )
    return(unsigned int)-1073741670;
  ElementDataWithFlags = BcdGetElementDataWithFlags(ObjectHandle, v7, v10, PoolWithTag, &NumberOfBytes);
  if( ElementDataWithFlags >= 0 )
  {
    *(_DWORD *)ElementSize = NumberOfBytes;
    *Element = PoolWithTag;
    goto LABEL_6;
  }
LABEL_7:
  if( PoolWithTag )
    ExFreePoolWithTag(PoolWithTag, 0x4B444342u);
  return(unsigned int)ElementDataWithFlags;
}

Referenced by:

BiAddBootEntryToEfiBootManagerDisplayOrder
BiCreateBootEntry
BiExportEfiBootManager
BiHandleFirmwareDefaultEntry
BiUpdateEfiEntry