ObReferenceObjectByPointerWithTag

NTSTATUS __stdcall ObReferenceObjectByPointerWithTag(
        VOID *Object,
        UINT64 DesiredAccess,
        _OBJECT_TYPE *ObjectType,
        INT8 AccessMode,
        UINT64 Tag){
  __int64 BugCheckParameter4; 

  if( !ObjectType )
  {
    if( !AccessMode )
      goto LABEL_3;
    return -1073741788;
  }
  if( (_OBJECT_TYPE *)ObTypeIndexTable[(unsigned __int8)ObHeaderCookie ^ (unsigned __int8)*((char *)Object - 24) ^ (unsigned __int64)(unsigned __int8)((unsigned __int16)((_WORD)Object - 48) >> 8)] != ObjectType )
    return -1073741788;
LABEL_3:
  if( ObpTraceFlags )
    ObpPushStackInfo((_OBJECT_HEADER *)((char *)Object - 48), 1u, 1ui64, (unsigned int)Tag);
  BugCheckParameter4 = _InterlockedIncrement64((volatile signed __int64 *)Object - 6);
  if( BugCheckParameter4 <= 1 )
    KeBugCheckEx(0x18u, 0i64, Object, (PVOID)0x10, (PVOID)BugCheckParameter4);
  return 0;
}

Referenced by:

IoRegisterPlugPlayNotification
ObOpenObjectByPointer