[PATCH 0/2] MR9927: mountmgr: Implement FileFsFullSizeInformationEx.
No application I am aware of needs this. We currently have an awkward divide between volume/disk/drive ioctls (and NtQueryVolumeInformationFile classes, which are technically not ioctls). Some are implemented in mountmgr, some in ntdll, some in both, and one (FSCTL_DISMOUNT_VOLUME) in the server. Which version is called depends on how the device is opened. NT paths of the form \??\A: or \DosDevices\A: go to ntdll, but other paths, such as \Device\HarddiskVolume0 or \??\Volume{...}, go to mountmgr. It is my intent to move everything to mountmgr (with the exception of NtQueryVolumeInformationFile, which can be called on any file in the volume, not just the volume device or volume root. Note that in many cases we do ultimately forward these calls to mountmgr via get_mountmgr_fs_info() anyway.) This means the following: - FileFsFullSizeInformationEx implemented in mountmgr - FileFsDeviceInformation implemented in ntoskrnl (this one is actually handled by the I/O manager) - FSCTL_DISMOUNT_VOLUME moved from server to mountmgr. mountmgr will have to call the server to close open files as part of this. - Everything inside of cdrom.c would be moved to mountmgr. This is a lot of thrashing, but will ultimately result in more natural code; in particular the ugly hacks for IOCTL_STORAGE_EJECT_MEDIA and the "cache" can effectively go away. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9927
From: Elizabeth Figura <zfigura@codeweavers.com> --- dlls/kernel32/tests/volume.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index 975aa7bb69d..f8d0a8be5d1 100644 --- a/dlls/kernel32/tests/volume.c +++ b/dlls/kernel32/tests/volume.c @@ -2149,6 +2149,7 @@ static void check_disk_space_information_(unsigned int line, const DISK_SPACE_IN static void test_GetDiskSpaceInformationA(void) { DISK_SPACE_INFORMATION info; + char volume[MAX_PATH]; HRESULT hr; /* GetDiskSpaceInformation() is supported on Windows 10 build 1809 and later */ @@ -2176,13 +2177,19 @@ static void test_GetDiskSpaceInformationA(void) ok(hr == S_OK, "failed 0x%08lx\n", hr); check_disk_space_information(&info); - hr = pGetDiskSpaceInformationA("C:\\", &info); + hr = pGetDiskSpaceInformationA("C:\\windows\\", &info); ok(hr == S_OK, "failed 0x%08lx\n", hr); check_disk_space_information(&info); hr = pGetDiskSpaceInformationA("\\\\?\\C:\\", &info); ok(hr == S_OK, "failed 0x%08lx\n", hr); check_disk_space_information(&info); + + GetVolumeNameForVolumeMountPointA("C:\\", volume, ARRAY_SIZE(volume)); + + hr = pGetDiskSpaceInformationA(volume, &info); + todo_wine ok(hr == S_OK, "got %#lx for %s\n", hr, debugstr_a(volume)); + check_disk_space_information(&info); } START_TEST(volume) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9927
From: Elizabeth Figura <zfigura@codeweavers.com> --- dlls/kernel32/tests/volume.c | 2 +- dlls/mountmgr.sys/device.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index f8d0a8be5d1..6560fb8ac27 100644 --- a/dlls/kernel32/tests/volume.c +++ b/dlls/kernel32/tests/volume.c @@ -2188,7 +2188,7 @@ static void test_GetDiskSpaceInformationA(void) GetVolumeNameForVolumeMountPointA("C:\\", volume, ARRAY_SIZE(volume)); hr = pGetDiskSpaceInformationA(volume, &info); - todo_wine ok(hr == S_OK, "got %#lx for %s\n", hr, debugstr_a(volume)); + ok(hr == S_OK, "got %#lx for %s\n", hr, debugstr_a(volume)); check_disk_space_information(&info); } diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 733d48aa05a..f73476cdcd4 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -1768,6 +1768,40 @@ static NTSTATUS WINAPI harddisk_query_volume( DEVICE_OBJECT *device, IRP *irp ) break; } + case FileFsFullSizeInformationEx: + { + FILE_FS_FULL_SIZE_INFORMATION_EX *info = irp->AssociatedIrp.SystemBuffer; + struct size_info size_info; + struct get_volume_size_info_params params = { dev->unix_mount, &size_info }; + + if (length < sizeof(FILE_FS_FULL_SIZE_INFORMATION_EX)) + { + status = STATUS_BUFFER_TOO_SMALL; + break; + } + + if ((status = MOUNTMGR_CALL( get_volume_size_info, ¶ms )) == STATUS_SUCCESS) + { + info->ActualTotalAllocationUnits = size_info.total_allocation_units; + info->ActualAvailableAllocationUnits = size_info.actual_available_allocation_units; + info->ActualPoolUnavailableAllocationUnits = 0; + info->CallerAvailableAllocationUnits = size_info.caller_available_allocation_units; + info->CallerPoolUnavailableAllocationUnits = 0; + info->UsedAllocationUnits = info->ActualTotalAllocationUnits - info->ActualAvailableAllocationUnits; + info->CallerTotalAllocationUnits = info->CallerAvailableAllocationUnits + info->UsedAllocationUnits; + info->TotalReservedAllocationUnits = 0; + info->VolumeStorageReserveAllocationUnits = 0; + info->AvailableCommittedAllocationUnits = 0; + info->PoolAvailableAllocationUnits = 0; + info->SectorsPerAllocationUnit = size_info.sectors_per_allocation_unit; + info->BytesPerSector = size_info.bytes_per_sector; + io->Information = sizeof(*info); + status = STATUS_SUCCESS; + } + + break; + } + default: FIXME("Unsupported volume query %x\n", irpsp->Parameters.QueryVolume.FsInformationClass); status = STATUS_NOT_SUPPORTED; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9927
participants (2)
-
Elizabeth Figura -
Elizabeth Figura (@zfigura)