PIO_STACK_LOCATION IrpSp;DEVICE_TYPE DeviceType IrpSp = IoGetCurrentIrpStackLocation(Irp);DeviceType = IrpSp->DeviceObject->DeviceType;