BiAcquireBcdSyncMutant

INT64 __stdcall BiAcquireBcdSyncMutant(UINT8 OfflineMode){
  HANDLE v1; 
  INT64 result; 
  struct _OBJECT_ATTRIBUTES ObjectAttributes; 
  void *MutantHandle; 
  union _LARGE_INTEGER Timeout; 
  if( OfflineMode )
    return 0i64;
  MutantHandle = 0i64;
  *(&ObjectAttributes.Length + 1) = 0;
  *(&ObjectAttributes.Attributes + 1) = 0;
  v1 = BcdMutantHandle;
  if( !BcdMutantHandle )
  {
    ObjectAttributes.RootDirectory = 0i64;
    ObjectAttributes.ObjectName = (_UNICODE_STRING *)L"8:";
    ObjectAttributes.Length = 48;
    ObjectAttributes.Attributes = 576;
    *(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
    LODWORD(result) = ZwOpenMutant(&MutantHandle, 0x100000ui64, &ObjectAttributes);
    if( (_DWORD)result == -1073741772 )
    {
      _InterlockedCompareExchange64((volatile signed __int64 *)&BcdMutantHandle, -1i64, 0i64);
    }
    else
    {
      if( (int)result < 0 )
        return result;
      if( _InterlockedCompareExchange64(
             (volatile signed __int64 *)&BcdMutantHandle,
             (signed __int64)MutantHandle,
             0i64) )
      {
        ZwClose(MutantHandle);
      }
    }
    v1 = BcdMutantHandle;
  }
  if( v1 == (HANDLE)-1i64 )
    return 0i64;
  Timeout.QuadPart = -600000000i64;
  LODWORD(result) = ZwWaitForSingleObject(v1, 0, &Timeout);
  if( (_DWORD)result == 258 )
    return 3221225473i64;
  return result;
}

Referenced by:

BcdCloseObject
BcdCloseStore
BcdCreateObject
BcdDeleteObject
BcdEnumerateObjects
BcdFlushStore
BcdForciblyUnloadStore
BcdGetElementDataWithFlags
BcdOpenObject
BcdOpenStore
BcdQueryObject
BcdSetElementDataWithFlags
BiDeleteElement
SepSecureBootCorrectBcd