CmpLogCheckpoint

INT64 __stdcall CmpLogCheckpoint(_CM_RM *CmRm, UINT8 FreeSpace){
  char v2; 
  int v3; 
  char v4; 
  _ETHREAD *CurrentThread; 
  const CLFS_LSN *v7; 
  NTSTATUS LogFileInformation; 
  CLFS_LSN ullOffset; 
  VOID **PoolWithTag; 
  VOID **v11; 
  void *MarshallingContext; 
  NTSTATUS v13; 
  VOID **v14; 
  VOID **v15; 
  const CLFS_LSN *v17; 
  CLFS_CONTAINER_ID v18; 
  CLFS_LSN plsn; 
  unsigned int pcbInfoBuffer; 
  unsigned int v21; 
  unsigned int v22; 
  int v23; 
  CLFS_LSN pvRestartBuffer; 
  LIST_ENTRY *ListIterator; 
  _CLS_LSN plsnNext; 
  struct _CLS_INFORMATION pinfoBuffer; 
  _EVENT_DATA_DESCRIPTOR v28; 
  int *v29; 
  int v30; 
  int v31; 

  v3 = 0;
  ListIterator = 0i64;
  v4 = v2;
  pvRestartBuffer.ullOffset = 0i64;
  plsn.ullOffset = CLFS_LSN_INVALID_EXT;
  plsnNext.ullOffset = CLFS_LSN_NULL_EXT;
  pcbInfoBuffer = 120;
  memset(&pinfoBuffer, 0i64, sizeof(pinfoBuffer));
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  --CurrentThread->Tcb.KernelApcDisable;
  ExAcquireFastMutexUnsafe((PFAST_MUTEX)((char *)&CmpDummyThreadEvent + 64));
  while( 1 )
  {
    LODWORD(v7) = CmListGetNextElement(&CmRm->TransactionListHead, &ListIterator, 0i64);
    if( !v7 )
      break;
    v17 = v7 + 13;
    if( !ClfsLsnInvalid(v7 + 13) )
    {
      v18 = ClfsLsnContainer((const CLFS_LSN *)&CmRm->BaseLsn);
      if( ClfsLsnContainer(v17) == v18 )
      {
        ExReleaseFastMutexUnsafe((PFAST_MUTEX)((char *)&CmpDummyThreadEvent + 64));
        KeLeaveCriticalRegionThread(KeGetCurrentThread());
        return 0i64;
      }
    }
    if( ClfsLsnInvalid(&plsn) || ClfsLsnLess(v17, &plsn) )
      plsn = *v17;
  }
  ExReleaseFastMutexUnsafe((PFAST_MUTEX)((char *)&CmpDummyThreadEvent + 64));
  KeLeaveCriticalRegionThread(KeGetCurrentThread());
  if( ClfsLsnInvalid(&plsn) )
  {
    LogFileInformation = ClfsGetLogFileInformation((PLOG_FILE_OBJECT)CmRm->LogFileObject, &pinfoBuffer, &pcbInfoBuffer);
    ullOffset = plsn;
    v3 = LogFileInformation;
    if( LogFileInformation >= 0 )
      ullOffset = (CLFS_LSN)pinfoBuffer.LastLsn.ullOffset;
    plsn = ullOffset;
  }
  v21 = 120;
  PoolWithTag = ExAllocatePoolWithTag(1ui64, 0x78ui64, 538987843i64);
  v11 = PoolWithTag;
  if( PoolWithTag )
  {
    ClfsGetLogFileInformation((PLOG_FILE_OBJECT)CmRm->LogFileObject, (PCLFS_INFORMATION)PoolWithTag, &v21);
    ExFreePoolWithTag(v11, 0);
  }
  if( v3 >= 0 )
  {
    MarshallingContext = CmRm->MarshallingContext;
    pvRestartBuffer = plsn;
    v13 = ClfsWriteRestartArea(
            MarshallingContext,
            &pvRestartBuffer,
            8u,
            (PCLFS_LSN)((unsigned __int64)&plsn & -(__int64)(v4 != 0)),
            0,
            &pcbInfoBuffer,
            &plsnNext);
    v3 = v13;
    if( v4 )
    {
      if( v13 >= 0 )
        CmRm->BaseLsn = plsn.ullOffset;
    }
  }
  v22 = 120;
  v14 = ExAllocatePoolWithTag(1ui64, 0x78ui64, 538987843i64);
  v15 = v14;
  if( v14 )
  {
    ClfsGetLogFileInformation((PLOG_FILE_OBJECT)CmRm->LogFileObject, (PCLFS_INFORMATION)v14, &v22);
    ExFreePoolWithTag(v15, 0);
  }
  if( *(&stru_140C00F40 + 1148) > 5u )
  {
    if( tlgKeywordOn((__int64)&stru_140C00F40 + 4592, 1i64) )
    {
      v31 = 0;
      v29 = &v23;
      v23 = v3;
      v30 = 4;
      tlgWriteTransfer_EtwWriteTransfer(
        (__int64)&stru_140C00F40 + 4592,
        (unsigned __int8 *)&word_140022B26,
        0i64,
        0i64,
        3u,
        &v28);
    }
  }
  return(unsigned int)v3;
}

Referenced by:

CmpStopRMLog
CmpTransWriteLog