CmpLogCheckpoint

__int64 __fastcall CmpLogCheckpoint(__int64 a1, __int64 a2, char a3){
  int v3; 
  _ETHREAD *CurrentThread; 
  __int64 v7; 
  NTSTATUS LogFileInformation; 
  INT64 v9; 
  CLFS_INFORMATION *PoolWithTag; 
  CLFS_INFORMATION *v11; 
  void *v12; 
  NTSTATUS v13; 
  CLFS_INFORMATION *v14; 
  CLFS_INFORMATION *v15; 
  const CLFS_LSN *v17; 
  CLFS_CONTAINER_ID v18; 
  __int64 v19; 
  ULONG pcbInfoBuffer; 
  ULONG v21; 
  ULONG v22; 
  int v23; 
  __int64 pvRestartBuffer; 
  LIST_ENTRY *ListIterator; 
  __int64 plsnNext; 
  INT64 result[16]; 
  struct _EVENT_DATA_DESCRIPTOR v28; 
  int *v29; 
  int v30; 
  int v31; 
  v3 = 0;
  ListIterator = 0i64;
  pvRestartBuffer = 0i64;
  v19 = CLFS_LSN_INVALID_EXT;
  plsnNext = CLFS_LSN_NULL_EXT;
  pcbInfoBuffer = 120;
  memset((INT64)result, 0i64);
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --*((_WORD *)CurrentThread + 242);
  ExAcquireFastMutexUnsafe(&CmpTransactionListLock);
  while( 1 )
  {
    LODWORD(v7) = CmListGetNextElement((LIST_ENTRY *)(a1 + 16), &ListIterator, 0i64);
    if( !v7 )
      break;
    v17 = (const CLFS_LSN *)(v7 + 104);
    if( !ClfsLsnInvalid((const CLFS_LSN *)(v7 + 104)) )
    {
      v18 = ClfsLsnContainer((const CLFS_LSN *)(a1 + 120));
      if( ClfsLsnContainer(v17) == v18 )
      {
        ExReleaseFastMutexUnsafe(&CmpTransactionListLock);
        KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
        return 0i64;
      }
    }
    if( ClfsLsnInvalid((const CLFS_LSN *)&v19) || ClfsLsnLess(v17, (const CLFS_LSN *)&v19) )
      v19 = *(_QWORD *)v17;
  }
  ExReleaseFastMutexUnsafe(&CmpTransactionListLock);
  KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
  if( ClfsLsnInvalid((const CLFS_LSN *)&v19) )
  {
    LogFileInformation = ClfsGetLogFileInformation(
                           *(PLOG_FILE_OBJECT *)(a1 + 88),
                           (PCLFS_INFORMATION)result,
                           &pcbInfoBuffer);
    v9 = v19;
    v3 = LogFileInformation;
    if( LogFileInformation >= 0 )
      v9 = result[11];
    v19 = v9;
  }
  v21 = 120;
  PoolWithTag = (CLFS_INFORMATION *)ExAllocatePoolWithTag(PagedPool, 0x78ui64, 0x20204D43ui64);
  v11 = PoolWithTag;
  if( PoolWithTag )
  {
    ClfsGetLogFileInformation(*(PLOG_FILE_OBJECT *)(a1 + 88), PoolWithTag, &v21);
    ExFreePoolWithTag(v11, 0);
  }
  if( v3 >= 0 )
  {
    v12 = *(void **)(a1 + 96);
    pvRestartBuffer = v19;
    v13 = ClfsWriteRestartArea(
            v12,
            &pvRestartBuffer,
            8u,
            (PCLFS_LSN)((unsigned __int64)&v19 & -(__int64)(a3 != 0)),
            0,
            &pcbInfoBuffer,
            (PCLFS_LSN)&plsnNext);
    v3 = v13;
    if( a3 )
    {
      if( v13 >= 0 )
        *(_QWORD *)(a1 + 120) = v19;
    }
  }
  v22 = 120;
  v14 = (CLFS_INFORMATION *)ExAllocatePoolWithTag(PagedPool, 0x78ui64, 0x20204D43ui64);
  v15 = v14;
  if( v14 )
  {
    ClfsGetLogFileInformation(*(PLOG_FILE_OBJECT *)(a1 + 88), v14, &v22);
    ExFreePoolWithTag(v15, 0);
  }
  if( (unsigned int)dword_140C02130 > 5 )
  {
    if( tlgKeywordOn((__int64)&dword_140C02130, 1i64) )
    {
      v31 = 0;
      v29 = &v23;
      v23 = v3;
      v30 = 4;
      tlgWriteTransfer_EtwWriteTransfer(
        (__int64)&dword_140C02130,
        (unsigned __int8 *)&word_140022B26,
        0i64,
        0i64,
        3u,
        &v28);
    }
  }
  return(unsigned int)v3;
}

Referenced by:

CmpStopRMLog
CmpTransWriteLog