CmpGetOrCreateContextForSiloNoRef

INT64 __stdcall CmpGetOrCreateContextForSiloNoRef(_EJOB *Job, UINT64 *a2){
  int SiloContext; 
  VOID *v5; 
  NTSTATUS inserted; 
  PVOID ReturnedSiloContext; 
  VOID *Object; 

  Object = 0i64;
  ReturnedSiloContext = 0i64;
  PsGetPermanentSiloContext(Job, *(unsigned int *)CmpSiloContextSlot, &ReturnedSiloContext);
  if( ReturnedSiloContext )
  {
    inserted = 0;
    *a2 = (UINT64)ReturnedSiloContext;
    return(unsigned int)inserted;
  }
  SiloContext = CmpAllocateSiloContext((INT64)Job, (INT64 *)&Object);
  v5 = Object;
  inserted = SiloContext;
  if( SiloContext >= 0 )
  {
    inserted = PsInsertPermanentSiloContextEx(Job, *(unsigned int *)CmpSiloContextSlot, Object, 0i64);
    if( inserted >= 0 )
      inserted = 0;
    if( inserted == -1073741637 )
    {
      ReturnedSiloContext = 0i64;
      PsGetPermanentSiloContext(Job, *(unsigned int *)CmpSiloContextSlot, &ReturnedSiloContext);
      *a2 = (UINT64)ReturnedSiloContext;
    }
    else
    {
      if( inserted < 0 )
        goto LABEL_9;
      *a2 = (UINT64)v5;
    }
    inserted = 0;
  }
LABEL_9:
  if( v5 )
    ObfDereferenceObjectWithTag(v5, 0x20314D43ui64);
  return(unsigned int)inserted;
}

Referenced by:

CmInitServerSiloState
VrpHandleIoctlInitializeJobForVreg