PspInsertProperty

INT64 __fastcall PspInsertProperty(UINT64 *a1, INT64 a2, VOID *a3){
  int v6; 
  UINT64 v7; 
  _QWORD *PoolWithTag; 
  unsigned __int8 v9; 
  unsigned __int64 v10; 
  UINT64 v11; 
  v6 = 0;
  PoolWithTag = ExAllocatePoolWithTag(NonPagedPoolNx, 0x20ui64, 0x50737050ui64);
  if( PoolWithTag )
  {
    KeAcquireSpinLockRaiseToDpc(a1 + 2, v7);
    v10 = v9;
    if( PspFindPropertySetEntry(a1, a2) )
    {
      v6 = -1073741771;
    }
    else
    {
      PoolWithTag[2] = a2;
      PoolWithTag[3] = a3;
      v11 = *a1;
      if( *(UINT64 **)(*a1 + 8) != a1 )
        __fastfail(3u);
      *PoolWithTag = v11;
      PoolWithTag[1] = a1;
      *(_QWORD *)(v11 + 8) = PoolWithTag;
      *a1 = (UINT64)PoolWithTag;
      ObfReferenceObjectWithTag(a3, 0x72507350u);
    }
    KxReleaseSpinLock(a1 + 2);
    __writecr8(v10);
    if( v6 < 0 )
      ExFreePoolWithTag(PoolWithTag, 0x50737050u);
  }
  else
  {
    return(unsigned int)-1073741801;
  }
  return(unsigned int)v6;
}

Referenced by:

PsSetJobProperty
PsSetThreadProperty