CmpBounceContextStart

INT64 __fastcall CmpBounceContextStart(INT64 a1, struct SLIST_ENTRY *a2, UINT64 a3, INT64 a4, CHAR a5){
  VOID *TransientPoolWithQuotaTag; 
  unsigned int v9; 
  char v10; 
  CHAR v11; 
  __int64 v12; 
  __int64 v13; 
  _EVENT_DATA_DESCRIPTOR v14; 
  __int64 *v15; 
  __int64 v16; 
  CHAR *v17; 
  __int64 v18; 
  __int64 *v19; 
  __int64 v20; 

  *(_QWORD *)a1 = a2;
  TransientPoolWithQuotaTag = a2;
  if( !a3 )
  {
    *(_QWORD *)(a1 + 8) = 0i64;
    return 0i64;
  }
  if( !*(&CmpDummyThreadEvent + 5) || !(_DWORD)a4 && CmpIsBufferGloballyVisible(a2) )
  {
LABEL_10:
    *(_QWORD *)(a1 + 8) = TransientPoolWithQuotaTag;
    return 0i64;
  }
  if( *(&stru_140C00F40 + 1148) > 5u
    && (*(&stru_140C00F40 + 4608) & 4) != 0
    && (*(&stru_140C00F40 + 4616) & 4) == *(&stru_140C00F40 + 577) )
  {
    v12 = 1i64;
    v15 = &v12;
    v9 = a3;
    v11 = a5;
    v17 = &v11;
    v16 = 8i64;
    v18 = 1i64;
    if( (((_DWORD)a3 - 1) & (unsigned int)a3) != 0 )
    {
      v10 = -1;
      if( (_DWORD)a3 )
      {
        do
        {
          ++v10;
          v9 >>= 1;
        }
        while( v9 );
      }
      v9 = 1 << (v10 + 1);
    }
    v13 = v9;
    v20 = 8i64;
    v19 = &v13;
    tlgWriteAgg((__int64)&stru_140C00F40 + 4592, (unsigned __int8 *)&byte_14002258B, a3, 5u, &v14);
  }
  if( a3 <= 0x40 )
  {
    TransientPoolWithQuotaTag = (VOID *)(a1 + 17);
LABEL_13:
    memset(TransientPoolWithQuotaTag, 0i64, a3);
    goto LABEL_10;
  }
  if( a3 <= 0x1000 )
  {
    ++*(&WheapErrorSourceTable + 399);
    TransientPoolWithQuotaTag = RtlpInterlockedPopEntrySList((PSLIST_HEADER)((char *)&WheapErrorSourceTable + 1576));
    if( TransientPoolWithQuotaTag
      || (++*(&WheapErrorSourceTable + 400),
          (TransientPoolWithQuotaTag = (VOID *)(*(&WheapErrorSourceTable + 203))(
                                                 *(&WheapErrorSourceTable + 403),
                                                 *(&WheapErrorSourceTable + 405),
                                                 *(&WheapErrorSourceTable + 404),
                                                 (char *)&WheapErrorSourceTable + 1576)) != 0i64) )
    {
      memset(TransientPoolWithQuotaTag, 0i64, a3);
      *(_BYTE *)(a1 + 16) |= 1u;
      goto LABEL_10;
    }
  }
  TransientPoolWithQuotaTag = CmpAllocateTransientPoolWithQuotaTag(a1, a3, 0x42424D43ui64);
  if( TransientPoolWithQuotaTag )
    goto LABEL_13;
  return 3221225626i64;
}

Referenced by:

NtEnumerateKey
NtEnumerateValueKey
NtQueryKey
NtQueryMultipleValueKey