diff --git a/drivers/storage/floppy/ioctl.c b/drivers/storage/floppy/ioctl.c index 976e02ef874..74a35175cb1 100644 --- a/drivers/storage/floppy/ioctl.c +++ b/drivers/storage/floppy/ioctl.c @@ -74,6 +74,7 @@ DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp) PVOID OutputBuffer = Irp->AssociatedIrp.SystemBuffer; ULONG Code = Stack->Parameters.DeviceIoControl.IoControlCode; BOOLEAN DiskChanged; + PMOUNTDEV_NAME Name; TRACE_(FLOPPY, "DeviceIoctl called\n"); Irp->IoStatus.Status = STATUS_SUCCESS; @@ -255,6 +256,29 @@ DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp) Irp->IoStatus.Information = 0; break; + case IOCTL_MOUNTDEV_QUERY_DEVICE_NAME: + if (OutputLength < sizeof(MOUNTDEV_NAME)) { + Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; + Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME); + break; + } + + Name = Irp->AssociatedIrp.SystemBuffer; + Name->NameLength = wcslen(&DriveInfo->SymLinkBuffer[0]) * sizeof(WCHAR); + + if (OutputLength < sizeof(USHORT) + Name->NameLength) { + Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW; + Irp->IoStatus.Information = sizeof(MOUNTDEV_NAME); + break; + } + + RtlCopyMemory(Name->Name, &DriveInfo->SymLinkBuffer[0], + Name->NameLength); + + Irp->IoStatus.Status = STATUS_SUCCESS; + Irp->IoStatus.Information = sizeof(USHORT) + Name->NameLength; + break; + default: ERR_(FLOPPY, "UNKNOWN IOCTL CODE: 0x%x\n", Code); Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; diff --git a/drivers/storage/floppy/precomp.h b/drivers/storage/floppy/precomp.h index 47af755c31a..bb0c015b934 100644 --- a/drivers/storage/floppy/precomp.h +++ b/drivers/storage/floppy/precomp.h @@ -2,6 +2,7 @@ #define _FLOPPY_PCH_ #include +#include #include "floppy.h" #include "csqrtns.h"