PnpDeviceObjectFromDeviceInstanceWithTag

_QWORD *__fastcall PnpDeviceObjectFromDeviceInstanceWithTag(__int64 a1, unsigned int a2){
  _QWORD *v2; 
  _QWORD **v4; 
  __int64 v5; 
  __int64 Buffer[3]; 

  Buffer[1] = a1;
  v2 = 0i64;
  Buffer[0] = 0i64;
  ExAcquireFastMutex(&Mutex);
  v4 = (_QWORD **)RtlLookupElementGenericTableAvl((_RTL_AVL_TABLE *)((char *)&PnpReplaceEvent + 8160), Buffer);
  if( v4 )
  {
    v2 = *v4;
    if( *v4 )
    {
      if( *(_WORD *)v2 == 3 )
      {
        v5 = *(_QWORD *)(v2[39] + 40i64);
        if( !v5 || *(_QWORD **)(v5 + 32) != v2 )
          v2 = 0i64;
        if( v2 )
          ObfReferenceObjectWithTag(v2, a2);
      }
      else
      {
        v2 = 0i64;
      }
    }
  }
  KeReleaseGuardedMutex(&Mutex);
  return v2;
}

Referenced by:

IoReportDetectedDevice
IopDeviceObjectFromSymbolicName
IopInitializeDeviceInstanceKey
IopProcessSetInterfaceState
NtReplacePartitionUnit
PiCMCreateDevice
PiControlGetPropertyData
PiControlGetSetDeviceStatus
PiControlQueryConflictList
PiDcResetChildDeviceContainerCallback
PiGetDeviceDepth
PiGetRelatedDevice
PiInitializeDevice
PiPnpRtlCmActionCallback
PiProcessNewDeviceNode
PiQueryDeviceRelations
PiQueueDeviceRequest
PiSwCloseDevice
PiSwGetChildPdo
PiSwIrpCleanup
PiSwIrpStartCreateWorker
PiSwProcessRemove
PipAddDevicesToBootDriverWorker
PipProcessDevNodeTree
PnpDriverLoadingFailed
PnpIsDeviceInstanceEnabled
PnpQueueQueryAndRemoveEvent