ExCleanupSessionHeapManager

VOID __stdcall ExCleanupSessionHeapManager(INT64 a1, INT64 a2, INT64 a3, INT64 a4){
  INT64 *v4; 
  INT64 v5; 
  INT64 v6; 
  INT64 *v7; 
  __int64 v8; 

  v4 = (INT64 *)*((_QWORD *)KeGetCurrentThread()->ApcState.Process->Session + 84);
  v5 = v4[1820];
  if( v5 )
    RtlpHpHeapDestroy(v5, a2, a3);
  v6 = v4[1821];
  if( v6 )
    RtlpHpHeapDestroy(v6, a2, a3);
  v7 = v4 + 1811;
  v8 = 3i64;
  do
  {
    if( *v7 )
      RtlpHpHeapDestroy(*v7, a2, a3);
    v7 += 2;
    --v8;
  }
  while( v8 );
  RtlCSparseBitmapCleanup((INT64)(v4 + 2));
  RtlCSparseBitmapCleanup((INT64)(v4 + 15));
  ExFreePoolWithTag(v4, 0x65537048u);
}

Referenced by:

ExInitializeSessionHeapManager
MiDereferenceSessionFinal