PnpQueryInterface

__int64 __fastcall PnpQueryInterface(
        PDEVICE_OBJECT DeviceObject,
        _IO_SECURITY_CONTEXT *a2,
        __int16 a3,
        unsigned __int16 a4,
        __int64 a5,
        VOID *a6){
  _DEVICE_OBJECT *v10; 
  _DEVICE_OBJECT *v11; 
  _IRP *v12; 
  _IO_STACK_LOCATION *CurrentStackLocation; 
  unsigned int Status; 
  _IO_STATUS_BLOCK IoStatusBlock; 
  __int128 Object; 
  __int64 v18; 
  VOID *ReturnAddress; 

  Object = 0i64;
  v18 = 0i64;
  IoStatusBlock = 0i64;
  if( a4 < 0x20u )
    return 3221225485i64;
  memset(a6, 0i64, a4);
  *(_WORD *)a6 = a4;
  *((_WORD *)a6 + 1) = a3;
  KeInitializeEvent((INT64)&Object, 0, 0);
  LODWORD(v10) = IoGetAttachedDeviceReferenceWithTag(DeviceObject, 0x49706E50u);
  v11 = v10;
  v12 = IopBuildSynchronousFsdRequest(
          0x1Bui64,
          v10,
          0i64,
          0i64,
          0i64,
          (_KEVENT *)&Object,
          &IoStatusBlock,
          ReturnAddress);
  if( v12 )
  {
    CurrentStackLocation = v12->Tail.CurrentStackLocation;
    v12->RequestorMode = 0;
    v12->IoStatus.Status = -1073741637;
    *(_QWORD *)&CurrentStackLocation[-1].Parameters.EaLength = a5;
    CurrentStackLocation[-1].MinorFunction = 8;
    CurrentStackLocation[-1].Parameters.SecurityContext = a2;
    LOWORD(CurrentStackLocation[-1].Parameters.Options) = a4;
    HIWORD(CurrentStackLocation[-1].Parameters.Options) = a3;
    *(_QWORD *)&CurrentStackLocation[-1].Parameters.FileAttributes = a6;
    Status = IofCallDriver((UINT64)v11, (UINT64)v12);
    if( Status == 259 )
    {
      KeWaitForSingleObject((UINT64)&Object, 0, 0, 0, 0i64);
      Status = IoStatusBlock.Status;
    }
  }
  else
  {
    Status = -1073741670;
  }
  ObfDereferenceObjectWithTag(v11, 0x49706E50ui64);
  return Status;
}

Referenced by:

IoQueryInterface
IopQueryBusResourceUpdateInterface
IopQueryInterfaceRecurseUp
PiGetDmaAdapterFromBusInterface
PiIommuGetInterface
PiProcessDriversLoadedOnSecureDevice
PiProcessNewDeviceNode
PipUnprotectDevice
PnpGetDeviceLocationStrings
PnprIdentifyUnits
PnprQueryReplaceFeatures