PsInsertPermanentSiloContextEx

INT64 __stdcall PsInsertPermanentSiloContextEx(_EJOB *Job, UINT64 StorageSlot, PVOID Object, INT64 a4){
  unsigned int v5; 
  struct _PSP_STORAGE *Storage; 
  __int64 v8; 
  char v9; 
  _EJOB **v10; 
  _ETHREAD *CurrentThread; 
  unsigned int inserted; 
  v5 = StorageSlot;
  if( (a4 & 0xFFFFFFFE) != 0 )
    return 3221225485i64;
  Storage = (struct _PSP_STORAGE *)qword_140D23990;
  if( Job )
    Storage = Job->Storage;
  if( PspIsSiloContext(Object) )
  {
    v10 = (*(_BYTE *)(v8 - 48 + 26) & 0x40) != 0 ? (_EJOB **)(*(_QWORD *)(v8
                                                                        - 48
                                                                        - *((unsigned __int8 *)ObpInfoMaskToOffset
                                                                          + (*(_BYTE *)(v8 - 48 + 26) & 0x7F)))
                                                            + 32i64) : 0i64;
    if( *v10 != Job )
      return 3221225485i64;
  }
  if( (v9 & 1) != 0 )
  {
    if( !Job )
      return 3221225520i64;
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    PspLockJobShared((__int64)Job, (__int64)CurrentThread);
    if( PspJobHasChildren((INT64)Job) )
    {
      inserted = -1073740529;
      goto LABEL_11;
    }
  }
  else
  {
    CurrentThread = 0i64;
  }
  inserted = PspStorageInsertObject((INT64)Storage, v5, 1, (INT64)Object);
LABEL_11:
  if( CurrentThread )
    PspUnlockJob((__int64)Job, (__int64)CurrentThread);
  return inserted;
}

Referenced by:

CmpGetOrCreateContextForSiloNoRef
ObCreateSiloRootDirectory
PsInsertPermanentSiloContext