ExAllocateTimerInternal2

CHAR *__fastcall ExAllocateTimerInternal2(INT64 a1, INT64 a2, INT16 *a3, UINT64 a4){
  ULONG_PTR v5; 
  _WORD *PoolWithTag; 
  unsigned __int64 v9; 
  __int64 v10; 
  INT64 v12; 
  UINT8 v13[2]; 
  INT16 v14; 
  v5 = (unsigned int)a4;
  if( !ExpExTimerAttributesAreValid((unsigned int)a4) || ((v5 & 2) != 0) != (a3 != 0i64) )
    KeBugCheckEx(0xC7u, 9ui64, 0i64, v5, 0i64);
  PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0xA0ui64, 0x6D547845ui64);
  v9 = (unsigned __int64)PoolWithTag;
  if( PoolWithTag )
  {
    if( (v5 & 2) != 0 )
    {
      *(_WORD *)v13 = *a3;
      v14 = a3[1];
      LODWORD(v12) = v5;
      KeInitializeIRTimer((INT64)PoolWithTag, a1, a2, v13, v12);
    }
    else
    {
      PoolWithTag[1] = 0;
      KiInitializeTimer2((INT64)PoolWithTag, a1, a2, (unsigned int)v5);
    }
    *(_QWORD *)(v9 + 136) = KiWaitNever ^ __ROR8__(v9 ^ _byteswap_uint64(KiWaitAlways), KiWaitNever);
    v10 = KiWaitNever ^ __ROR8__(v9 ^ _byteswap_uint64(KiWaitAlways), KiWaitNever);
    *(_BYTE *)(v9 + 152) = ExpTimerFreedCookie;
    *(_QWORD *)(v9 + 144) = v10;
  }
  return(CHAR *)v9;
}

Referenced by:

ExAllocateTimer
ExAllocateTimerInternal