BiEnumerateBootEntries

__int64 __fastcall BiEnumerateBootEntries(_QWORD *a1, _DWORD *a2){
  NTSTATUS v4; 
  void *PoolWithTag; 
  void *v6; 
  NTSTATUS v7; 
  SIZE_T NumberOfBytes; 
  __int64 v10; 
  v10 = 0i64;
  v4 = BiAcquirePrivilege(0x16u, (__int64)&v10);
  if( v4 >= 0 )
  {
    LODWORD(NumberOfBytes) = 0x2000;
    PoolWithTag = ExAllocatePoolWithTag(PagedPool, 0x2000ui64, 0x4B444342ui64);
    v6 = PoolWithTag;
    LODWORD(NumberOfBytes) = PoolWithTag != 0i64 ? NumberOfBytes : 0;
    while( 1 )
    {
      v7 = ZwEnumerateBootEntries(PoolWithTag, &NumberOfBytes);
      v4 = v7;
      if( v7 != -1073741789 )
        break;
      if( v6 )
        ExFreePoolWithTag(v6, 0x4B444342u);
      PoolWithTag = ExAllocatePoolWithTag(PagedPool, (unsigned int)NumberOfBytes, 0x4B444342ui64);
      v6 = PoolWithTag;
      if( !PoolWithTag )
      {
        v4 = -1073741670;
        goto LABEL_12;
      }
    }
    if( v7 >= 0 )
    {
      *a2 = NumberOfBytes;
      *a1 = v6;
    }
    else
    {
      BiLogMessage();
      if( v6 )
        ExFreePoolWithTag(v6, 0x4B444342u);
    }
LABEL_12:
    BiReleasePrivilege((__int64)&v10);
  }
  return(unsigned int)v4;
}

Referenced by:

BiBuildIdentifierList