Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ntdll/file.c | 36 ++++++++++++++++++++++++++++++++---- dlls/ntdll/tests/file.c | 5 +---- 2 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index d8576caa18c..f665d1f669a 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -3264,7 +3264,6 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io { int fd, needs_close; struct stat st; - static int once;
io->u.Status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL ); if (io->u.Status == STATUS_BAD_DEVICE_TYPE) @@ -3287,9 +3286,6 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io
switch( info_class ) { - case FileFsVolumeInformation: - if (!once++) FIXME( "%p: volume info not supported\n", handle ); - break; case FileFsLabelInformation: FIXME( "%p: label info not supported\n", handle ); break; @@ -3450,6 +3446,38 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io io->u.Status = STATUS_SUCCESS; break; } + case FileFsVolumeInformation: + { + FILE_FS_VOLUME_INFORMATION *info = buffer; + struct mountmgr_unix_drive *drive; + const WCHAR *label; + + if (length < sizeof(FILE_FS_VOLUME_INFORMATION)) + { + io->u.Status = STATUS_INFO_LENGTH_MISMATCH; + break; + } + + if (!(drive = get_mountmgr_fs_info( handle, fd ))) + { + ERR_(winediag)("Failed to query volume information from mountmgr.\n"); + io->u.Status = STATUS_NOT_IMPLEMENTED; + break; + } + + label = (WCHAR *)((char *)drive + drive->label_offset); + info->VolumeCreationTime.QuadPart = 0; /* FIXME */ + info->VolumeSerialNumber = drive->serial; + info->VolumeLabelLength = min( strlenW( label ) * sizeof(WCHAR), + length - offsetof( FILE_FS_VOLUME_INFORMATION, VolumeLabel ) ); + info->SupportsObjects = (drive->fs_type == MOUNTMGR_FS_TYPE_NTFS); + memcpy( info->VolumeLabel, label, info->VolumeLabelLength ); + RtlFreeHeap( GetProcessHeap(), 0, drive ); + + io->Information = offsetof( FILE_FS_VOLUME_INFORMATION, VolumeLabel ) + info->VolumeLabelLength; + io->u.Status = STATUS_SUCCESS; + break; + } case FileFsControlInformation: FIXME( "%p: control info not supported\n", handle ); break; diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 88be357fe8b..f2e4ff069fd 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -3866,8 +3866,6 @@ static void test_query_volume_information_file(void)
ffvi = (FILE_FS_VOLUME_INFORMATION *)buf;
-todo_wine -{ ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %d\n", status); ok(U(io).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %d\n", U(io).Status);
@@ -3875,10 +3873,9 @@ todo_wine "expected %d, got %lu\n", (FIELD_OFFSET(FILE_FS_VOLUME_INFORMATION, VolumeLabel) + ffvi->VolumeLabelLength), io.Information);
- ok(ffvi->VolumeCreationTime.QuadPart != 0, "Missing VolumeCreationTime\n"); + todo_wine ok(ffvi->VolumeCreationTime.QuadPart != 0, "Missing VolumeCreationTime\n"); ok(ffvi->VolumeSerialNumber != 0, "Missing VolumeSerialNumber\n"); ok(ffvi->SupportsObjects == 1,"expected 1, got %d\n", ffvi->SupportsObjects); -} ok(ffvi->VolumeLabelLength == lstrlenW(ffvi->VolumeLabel) * sizeof(WCHAR), "got %d\n", ffvi->VolumeLabelLength);
trace("VolumeSerialNumber: %x VolumeLabelName: %s\n", ffvi->VolumeSerialNumber, wine_dbgstr_w(ffvi->VolumeLabel));