ExTryAcquirePushLockSharedEx

UINT8 __stdcall ExTryAcquirePushLockSharedEx(
        _GUID *ObjectType,
        _IOBJECT_TYPE_LIST *ObjectTypeList,
        UINT64 ObjectTypeListLength,
        UINT64 *ReturnedIndex){
  __int64 v4; 
  _ETHREAD *CurrentThread; 
  __int64 AbOrphanedEntrySummary; 
  char v8; 
  NTSTATUS SessionId; 
  bool v10; 
  UINT64 a3; 

  v4 = 0i64;
  if( ((unsigned int)ObjectTypeList & 0xFFFFFFFC) != 0 )
    KeBugCheckEx(0x152u, (PVOID)(unsigned int)ObjectTypeList, ObjectType, 0i64, 0i64);
  if( ((unsigned __int8)ObjectTypeList & 2) == 0 )
  {
    LODWORD(a3) = 0;
    CurrentThread = (_ETHREAD *)KeGetCurrentThread();
    --CurrentThread->Tcb.SpecialApcDisable;
    if( ++CurrentThread->Tcb.AbAllocationRegionCount != 1 )
      goto LABEL_11;
    LOBYTE(AbOrphanedEntrySummary) = CurrentThread->Tcb.AbEntrySummary;
    if( !(_BYTE)AbOrphanedEntrySummary )
    {
      if( !CurrentThread->Tcb.AbOrphanedEntrySummary )
      {
LABEL_6:
        if( v4 )
        {
          if( (unsigned __int64)ObjectType >= 0xFFFF800000000000ui64
            && *((_BYTE *)&stru_140C4DB30 + (((unsigned __int64)ObjectType >> 39) & 0x1FF) + 6872) == 1 )
          {
            SessionId = MmGetSessionIdEx(CurrentThread->Tcb.ApcState.Process);
          }
          else
          {
            SessionId = -1;
          }
          *(_DWORD *)(v4 + 40) = SessionId;
          *(_QWORD *)(v4 + 32) = (unsigned __int64)ObjectType & 0x7FFFFFFFFFFFFFFCi64;
LABEL_12:
          --CurrentThread->Tcb.AbAllocationRegionCount;
          KiAbThreadRemoveBoosts(&CurrentThread->Tcb, ObjectType, &a3);
          v10 = CurrentThread->Tcb.SpecialApcDisable++ == -1;
          if( v10
            && ($F25F8C4BA33AF922A5F1AF68CD89DDDF *)CurrentThread->Tcb.ApcState.ApcListHead[0].Flink != &CurrentThread->Tcb.152 )
          {
            KiCheckForKernelApcDelivery();
          }
          goto LABEL_15;
        }
LABEL_11:
        _interlockedbittestandset((volatile signed __int32 *)&CurrentThread->Tcb.116 + 1, 0x10u);
        goto LABEL_12;
      }
      AbOrphanedEntrySummary = CurrentThread->Tcb.AbOrphanedEntrySummary;
      CurrentThread->Tcb.AbOrphanedEntrySummary = 0;
      LOBYTE(AbOrphanedEntrySummary) = CurrentThread->Tcb.AbEntrySummary | AbOrphanedEntrySummary;
    }
    v8 = AbOrphanedEntrySummary;
    _BitScanForward((unsigned int *)&AbOrphanedEntrySummary, (unsigned __int8)AbOrphanedEntrySummary);
    CurrentThread->Tcb.AbEntrySummary = v8 & ~(1 << AbOrphanedEntrySummary);
    v4 = (__int64)&CurrentThread->Tcb.LockEntries[AbOrphanedEntrySummary];
    goto LABEL_6;
  }
LABEL_15:
  if( !_InterlockedCompareExchange64((volatile signed __int64 *)ObjectType, 17i64, 0i64)
    || ExfTryAcquirePushLockShared((_EX_PUSH_LOCK *)ObjectType) )
  {
    if( v4 )
      *(_BYTE *)(v4 + 26) |= 1u;
    return 1;
  }
  else
  {
    if( v4 )
      KeAbPostReleaseEx(ObjectType, (VOID *)v4);
    return 0;
  }
}

Referenced by:

No references.