IopGetDeviceAttachmentBase

_DEVICE_OBJECT *__stdcall IopGetDeviceAttachmentBase(_DEVICE_OBJECT *DeviceObject){
  _DEVICE_OBJECT *v1; 
  _DEVICE_OBJECT *i; 

  v1 = DeviceObject;
  for( i = DeviceObject->DeviceObjectExtension->AttachedTo; i; i = i->DeviceObjectExtension->AttachedTo )
    v1 = i;
  return v1;
}

Referenced by:

IoGetDeviceAttachmentBaseRefWithTag
IopAttachDeviceToDeviceStackSafe
IopCompleteUnloadOrDelete
IopGetDevicePDO
IopVerifyDriverObjectOnStack