BcdOpenObject

INT64 __stdcall BcdOpenObject(PVOID StoreHandle, GUID *Identifier, PVOID *ObjectHandle){
  _UNICODE_STRING *v3; 
  UINT8 IsOfflineHandle; 
  INT64 result; 
  int v9; 
  wchar_t *Buffer; 
  int v11; 
  int CurrentBootEntryIdentifier; 
  PVOID Handle; 
  struct _UNICODE_STRING UnicodeString; 
  GUID Guid; 
  int a2; 
  *(_QWORD *)&UnicodeString.Length = 0i64;
  a2 = 0;
  Guid = 0i64;
  IsOfflineHandle = BiIsOfflineHandle((_HHIVE *)StoreHandle, (UINT64)Identifier, (_UNICODE_STRING *)ObjectHandle, v3);
  result = BiAcquireBcdSyncMutant(IsOfflineHandle);
  if( (int)result < 0 )
    return result;
  *ObjectHandle = 0i64;
  Handle = 0i64;
  UnicodeString.Buffer = 0i64;
  v9 = RtlStringFromGUIDEx(Identifier, &UnicodeString, 1u);
  if( v9 < 0 )
    goto LABEL_18;
  Buffer = UnicodeString.Buffer;
  BiLogMessage();
  v9 = BiOpenKey(StoreHandle, (WCHAR *)L"Objects", 0x20019ui64, &Handle);
  if( v9 < 0 )
    goto LABEL_23;
  if( BiIsObjectAliased(Identifier, &a2) )
  {
    if( a2 == 1 )
    {
      CurrentBootEntryIdentifier = BiGetCurrentBootEntryIdentifier(&Guid);
    }
    else
    {
      if( a2 != 2 )
      {
        v9 = -1073741811;
LABEL_15:
        if( v9 < 0 )
          goto LABEL_23;
        RtlFreeAnsiString(&UnicodeString);
        UnicodeString.Buffer = 0i64;
        v9 = RtlStringFromGUIDEx(&Guid, &UnicodeString, 1u);
        if( v9 >= 0 )
        {
          Buffer = UnicodeString.Buffer;
          BiLogMessage();
          goto LABEL_5;
        }
LABEL_18:
        BiLogMessage();
        Buffer = UnicodeString.Buffer;
        goto LABEL_6;
      }
      CurrentBootEntryIdentifier = BiGetDefaultBootEntryIdentifier(StoreHandle, &Guid);
    }
    v9 = CurrentBootEntryIdentifier;
    goto LABEL_15;
  }
LABEL_5:
  v11 = BiOpenKey(Handle, Buffer, 0xF003Fui64, ObjectHandle);
  v9 = v11;
  if( v11 < 0 )
LABEL_23:
    BiLogMessage();
LABEL_6:
  if( Buffer )
    RtlFreeAnsiString(&UnicodeString);
  if( Handle )
    BiCloseKey(Handle);
  BiReleaseBcdSyncMutant(IsOfflineHandle);
  return(unsigned int)v9;
}

Referenced by:

BiAddBootEntryToEfiBootManagerDisplayOrder
BiBindEfiBootManager
BiBindEfiEntries
BiBuildIdentifierList
BiCreateEfiEntry
BiExportEfiBootManager
BiGetDefaultBootEntryIdentifier
BiUpdateBcdObject
BiUpdateEfiEntry
PopBcdClearPendingResume
PopBcdEstablishResumeObject
PopBcdSetPendingResume
SepSecureBootCorrectBcd
WheaPersistBadPageToBcd