From: Elizabeth Figura <zfigura@codeweavers.com> --- dlls/ntoskrnl.exe/ntoskrnl.c | 30 ++++++++++++++++++++++++++++++ dlls/ntoskrnl.exe/tests/driver.c | 2 +- dlls/ntoskrnl.exe/tests/ntoskrnl.c | 17 +++++++---------- 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 92dbfe7a282..d74feb8ae90 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -514,6 +514,7 @@ struct dispatch_context static NTSTATUS dispatch_irp( DEVICE_OBJECT *device, IRP *irp, struct dispatch_context *context ) { + IO_STACK_LOCATION *irpsp = IoGetNextIrpStackLocation( irp ); struct irp_data *irp_data; LARGE_INTEGER count; NTSTATUS status; @@ -529,6 +530,35 @@ static NTSTATUS dispatch_irp( DEVICE_OBJECT *device, IRP *irp, struct dispatch_c context->irp_data = irp_data; context->handle = 0; + if (irpsp->MajorFunction == IRP_MJ_QUERY_VOLUME_INFORMATION + && irpsp->Parameters.QueryVolume.FsInformationClass == FileFsDeviceInformation) + { + /* Handled by us; never passed to the driver. */ + DEVICE_OBJECT *bottom_device = irp->Tail.Overlay.OriginalFileObject->DeviceObject; + NTSTATUS status; + + --irp->CurrentLocation; + --irp->Tail.Overlay.CurrentStackLocation; + + if (irpsp->Parameters.QueryVolume.Length >= sizeof(FILE_FS_DEVICE_INFORMATION)) + { + FILE_FS_DEVICE_INFORMATION *info = irp->AssociatedIrp.SystemBuffer; + + info->DeviceType = bottom_device->DeviceType; + info->Characteristics = bottom_device->Characteristics; + irp->IoStatus.Information = sizeof(*info); + status = STATUS_SUCCESS; + } + else + { + status = STATUS_INFO_LENGTH_MISMATCH; + } + + irp->IoStatus.Status = status; + IoCompleteRequest( irp, IO_NO_INCREMENT ); + return status; + } + KeQueryTickCount( &count ); /* update the global KeTickCount */ device->CurrentIrp = irp; diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index 76f7fd8d116..9358cf605a4 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -2983,7 +2983,7 @@ static NTSTATUS WINAPI driver_QueryVolumeInformation(DEVICE_OBJECT *device, IRP case FileFsDeviceInformation: /* This one is actually handled by the I/O manager; * it's never passed down to a driver. */ - todo_wine ok(0, "Unexpected call.\n"); + ok(0, "Unexpected call.\n"); /* fall through */ default: ret = STATUS_NOT_IMPLEMENTED; diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c index 944449ca859..06279b1c49e 100644 --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c @@ -1212,22 +1212,19 @@ static void test_object_info(void) io.Status = 0xdeadf00d; io.Information = 0xdeadf00d; status = NtQueryVolumeInformationFile(device, &io, &device_info, sizeof(device_info) - 1, FileFsDeviceInformation); - todo_wine ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx\n", status); + ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx\n", status); ok(io.Status == 0xdeadf00d, "got status %#lx\n", io.Status); ok(io.Information == 0xdeadf00d, "got information %Iu\n", io.Information); io.Status = 0xdeadf00d; io.Information = 0xdeadf00d; status = NtQueryVolumeInformationFile(device, &io, &device_info, sizeof(device_info), FileFsDeviceInformation); - todo_wine ok(!status, "got %#lx\n", status); - todo_wine ok(!io.Status, "got status %#lx\n", io.Status); - todo_wine ok(io.Information == sizeof(FILE_FS_DEVICE_INFORMATION), "got information %Iu\n", io.Information); - if (!status) - { - ok(device_info.DeviceType == FILE_DEVICE_UNKNOWN, "Got type %#lx.\n", device_info.DeviceType); - ok(device_info.Characteristics == (FILE_DEVICE_SECURE_OPEN | FILE_FLOPPY_DISKETTE | FILE_PORTABLE_DEVICE), - "Got characteristics %#lx.\n", device_info.Characteristics); - } + ok(!status, "got %#lx\n", status); + ok(!io.Status, "got status %#lx\n", io.Status); + ok(io.Information == sizeof(FILE_FS_DEVICE_INFORMATION), "got information %Iu\n", io.Information); + ok(device_info.DeviceType == FILE_DEVICE_UNKNOWN, "Got type %#lx.\n", device_info.DeviceType); + ok(device_info.Characteristics == (FILE_DEVICE_SECURE_OPEN | FILE_FLOPPY_DISKETTE | FILE_PORTABLE_DEVICE), + "Got characteristics %#lx.\n", device_info.Characteristics); file = CreateFileA("\\\\.\\WineTestDriver\\subfile", 0, 0, NULL, OPEN_EXISTING, 0, NULL); todo_wine ok(file != INVALID_HANDLE_VALUE, "got error %lu\n", GetLastError()); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9941