IopQueryInterfaceRecurseUp

NTSTATUS __stdcall IopQueryInterfaceRecurseUp(
        _DEVICE_OBJECT *Device,
        _GUID *InterfaceType,
        UINT16 Size,
        UINT16 Version,
        PVOID InterfaceSpecificData,
        _INTERFACE *Interface){
  _DEVICE_OBJECT *DeviceAttachmentBaseRefWithTag; 
  _DEVICE_OBJECT *v11; 
  PDEVICE_OBJECT *DeviceNode; 
  NTSTATUS v13; 

  PpDevNodeLockTree(PPL_SIMPLE_READ);
  DeviceAttachmentBaseRefWithTag = IoGetDeviceAttachmentBaseRefWithTag(Device, 0x49706E50ui64);
  v11 = DeviceAttachmentBaseRefWithTag;
  if( DeviceAttachmentBaseRefWithTag )
    DeviceNode = (PDEVICE_OBJECT *)DeviceAttachmentBaseRefWithTag->DeviceObjectExtension->DeviceNode;
  else
    DeviceNode = 0i64;
  if( DeviceNode == (PDEVICE_OBJECT *)*(&PnpReplaceEvent + 831) )
  {
LABEL_8:
    v13 = -1073741637;
  }
  else
  {
    while( DeviceNode && *((_DWORD *)DeviceNode + 75) != 788 )
    {
      v13 = PnpQueryInterface(
              DeviceNode[4],
              (_IO_SECURITY_CONTEXT *)InterfaceType,
              Version,
              Size,
              (__int64)InterfaceSpecificData,
              Interface);
      if( v13 != -1073741637 )
        goto LABEL_9;
      DeviceNode = (PDEVICE_OBJECT *)DeviceNode[2];
      if( DeviceNode == (PDEVICE_OBJECT *)*(&PnpReplaceEvent + 831) )
        goto LABEL_8;
    }
    v13 = -1073741130;
  }
LABEL_9:
  ObfDereferenceObjectWithTag(v11, 0x49706E50ui64);
  PpDevNodeUnlockTree(PPL_SIMPLE_READ);
  return v13;
}

Referenced by:

IoQueryInterface