CmpTransInitializeTransaction

__int64 __fastcall CmpTransInitializeTransaction(__int64 a1){
  INT64 v1; 
  int v3; 
  int started; 
  void *v5; 
  __int64 v6; 
  __int64 v7; 
  _ETHREAD *CurrentThread; 
  int v10[8]; 
  __int64 v11; 
  PVOID Object; 
  _CM_TRANS *CmTrans; 
  CmTrans = 0i64;
  v1 = 0i64;
  v3 = 64;
  if( *(_QWORD *)(a1 + 56) )
  {
    if( *(PVOID *)(a1 + 64) != CmRmSystem )
    {
      started = CmpTransSearchAddTransFromRm((_CM_RM *)CmRmSystem, *(_CM_TRANS_PTR *)(a1 + 56), 0i64, 1ui64, &CmTrans);
      if( started < 0 )
        return(unsigned int)started;
    }
    v1 = *(_QWORD *)(a1 + 56);
    started = CmpTransReferenceTransaction(v1);
    if( started < 0 )
      return(unsigned int)started;
    started = CmpStartRMLogs(*(_QWORD *)(a1 + 64));
    if( started < 0 )
      goto LABEL_16;
    started = CmTmCreateEnlistment((VOID *)(a1 + 80), *(_QWORD *)(*(_QWORD *)(a1 + 64) + 56i64));
    if( started < 0 )
      goto LABEL_16;
    v11 = 0i64;
    v5 = *(void **)(a1 + 80);
    Object = 0i64;
    ObReferenceObjectByHandle(v5, 0, 0i64, 0, &Object, 0i64);
    v6 = *(_QWORD *)(a1 + 64);
    *(_QWORD *)(a1 + 72) = Object;
    if( (int)CmpAccountForLogReservation(v6, v7, 1) >= 0 )
      v3 = 96;
  }
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --*((_WORD *)CurrentThread + 242);
  ExAcquireFastMutexUnsafe(&CmpTransactionListLock);
  if( (*(_DWORD *)(a1 + 48) & 6) == 0 )
  {
    *(_DWORD *)(a1 + 48) = v3;
    --CmpTransactionInitializingCount;
    ExReleaseFastMutexUnsafe(&CmpTransactionListLock);
    KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
    _InterlockedOr(v10, 0);
    if( CmpTransactionInitializingEvent.0 )
      ExfUnblockPushLock(&CmpTransactionInitializingEvent, 0i64);
    return 0;
  }
  started = -1072103422;
  ExReleaseFastMutexUnsafe(&CmpTransactionListLock);
  KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
LABEL_16:
  if( v1 )
    CmpTransDereferenceTransaction(v1);
  return(unsigned int)started;
}

Referenced by:

CmpTransSearchAddTrans