RtlpLogExceptionHandler

_LIST_ENTRY *__fastcall RtlpLogExceptionHandler(_LIST_ENTRY *a1, _LIST_ENTRY *a2, _LIST_ENTRY *a3, _LIST_ENTRY *a4){
  __int64 v8; 
  unsigned int v9; 
  bool i; 
  signed __int32 v11; 
  int v12; 
  signed __int32 v13; 
  __int64 v14; 
  _LIST_ENTRY *v15; 
  __int64 v16; 
  _LIST_ENTRY v17; 
  _LIST_ENTRY v18; 

  if( !*(&stru_140CF2E80 + 822) )
    return 0i64;
  v9 = RtlpExceptionLogCount;
  v12 = RtlpExceptionLogCount;
  v11 = _InterlockedCompareExchange(&RtlpExceptionLogCount, (RtlpExceptionLogCount + 1) % 0x32u, RtlpExceptionLogCount);
  for( i = v12 == v11; ; i = v11 == v13 )
  {
    v13 = v11;
    if( i )
      break;
    v9 = v11;
    v11 = _InterlockedCompareExchange(&RtlpExceptionLogCount, (v11 + 1) % 0x32u, v11);
  }
  v14 = 1424i64 * v9;
  i = *(&stru_140CF2E80 + 822) + v14 == 0;
  v8 = *(&stru_140CF2E80 + 822) + v14;
  *(_QWORD *)(v8 + 1400) = KeGetCurrentThread();
  if( !i )
  {
    *(_DWORD *)(v8 + 1396) = -1;
    v15 = (_LIST_ENTRY *)(v8 + 160);
    *(_DWORD *)(v8 + 1392) = 2;
    *(_LIST_ENTRY *)v8 = *a1;
    *(_LIST_ENTRY *)(v8 + 16) = a1[1];
    *(_LIST_ENTRY *)(v8 + 32) = a1[2];
    *(_LIST_ENTRY *)(v8 + 48) = a1[3];
    *(_LIST_ENTRY *)(v8 + 64) = a1[4];
    *(_LIST_ENTRY *)(v8 + 80) = a1[5];
    *(_LIST_ENTRY *)(v8 + 96) = a1[6];
    *(_LIST_ENTRY *)(v8 + 112) = a1[7];
    *(_LIST_ENTRY *)(v8 + 128) = a1[8];
    *(_QWORD *)(v8 + 144) = a1[9].Flink;
    v16 = 9i64;
    do
    {
      *v15 = *a2;
      v15[1] = a2[1];
      v15[2] = a2[2];
      v15[3] = a2[3];
      v15[4] = a2[4];
      v15[5] = a2[5];
      v15[6] = a2[6];
      v15 += 8;
      v17 = a2[7];
      a2 += 8;
      v15[-1] = v17;
      --v16;
    }
    while( v16 );
    *v15 = *a2;
    v15[1] = a2[1];
    v15[2] = a2[2];
    v15[3] = a2[3];
    v18 = a2[4];
    *(_QWORD *)(v8 + 1408) = a3;
    *(_QWORD *)(v8 + 1416) = a4;
    v15[4] = v18;
    *(_DWORD *)(v8 + 208) &= 0x10001Fu;
  }
  return(_LIST_ENTRY *)v8;
}

Referenced by:

RtlDispatchException