https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9168226378740cf69bbaf…
commit 9168226378740cf69bbaf18b1568be39db526fb5
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Tue Mar 20 22:15:16 2018 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Wed Mar 21 19:22:13 2018 +0100
[AFD] Respond to FileFsDeviceInformation.
CORE-13067
---
drivers/network/afd/afd/main.c | 52 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/drivers/network/afd/afd/main.c b/drivers/network/afd/afd/main.c
index 8cdfb1a269..8f3886ef5c 100644
--- a/drivers/network/afd/afd/main.c
+++ b/drivers/network/afd/afd/main.c
@@ -847,6 +847,53 @@ AfdDisconnect(PDEVICE_OBJECT DeviceObject, PIRP Irp,
return UnlockAndMaybeComplete( FCB, Status, Irp, 0 );
}
+NTSTATUS
+AfdQueryFsDeviceInfo(PDEVICE_OBJECT DeviceObject, PFILE_FS_DEVICE_INFORMATION Buffer,
PULONG Length)
+{
+ if (*Length >= sizeof(FILE_FS_DEVICE_INFORMATION))
+ {
+ Buffer->Characteristics = 0;
+ Buffer->DeviceType = FILE_DEVICE_NAMED_PIPE;
+
+ *Length -= sizeof(FILE_FS_DEVICE_INFORMATION);
+
+ return STATUS_SUCCESS;
+ }
+ else
+ {
+ ASSERT(*Length >= sizeof(FILE_FS_DEVICE_INFORMATION));
+ return STATUS_INFO_LENGTH_MISMATCH;
+ }
+}
+
+static NTSTATUS NTAPI
+AfdQueryVolumeInformation(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION
IrpSp)
+{
+ FS_INFORMATION_CLASS InfoClass;
+ PVOID Buffer;
+ ULONG Length;
+ NTSTATUS Status = STATUS_INVALID_INFO_CLASS;
+
+ Buffer = Irp->AssociatedIrp.SystemBuffer;
+ Length = IrpSp->Parameters.QueryVolume.Length;
+ InfoClass = IrpSp->Parameters.QueryVolume.FsInformationClass;
+
+ switch (InfoClass)
+ {
+ case FileFsDeviceInformation:
+ Status = AfdQueryFsDeviceInfo(DeviceObject, Buffer, &Length);
+ break;
+ default:
+ break;
+ }
+
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = IrpSp->Parameters.QueryVolume.Length - Length;
+ IoCompleteRequest(Irp, IO_NETWORK_INCREMENT);
+
+ return Status;
+}
+
static DRIVER_DISPATCH AfdDispatch;
static NTSTATUS NTAPI
AfdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
@@ -888,6 +935,10 @@ AfdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp)
case IRP_MJ_READ:
return AfdConnectedSocketReadData( DeviceObject, Irp, IrpSp, TRUE );
+ /* query volume info */
+ case IRP_MJ_QUERY_VOLUME_INFORMATION:
+ return AfdQueryVolumeInformation(DeviceObject, Irp, IrpSp);
+
case IRP_MJ_DEVICE_CONTROL:
{
switch( IrpSp->Parameters.DeviceIoControl.IoControlCode ) {
@@ -1265,6 +1316,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING
RegistryPath)
DriverObject->MajorFunction[IRP_MJ_WRITE] = AfdDispatch;
DriverObject->MajorFunction[IRP_MJ_READ] = AfdDispatch;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = AfdDispatch;
+ DriverObject->MajorFunction[IRP_MJ_QUERY_VOLUME_INFORMATION] = AfdDispatch;
DriverObject->DriverUnload = AfdUnload;
Status = IoCreateDevice(DriverObject,