ntdll: Implement NtQueryVolumeInformationFile(FileFsVolumeInformation).

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-03-27 10:32:33 -05:00 committed by Alexandre Julliard
parent 19b8aadf4b
commit 021d9f0760
2 changed files with 34 additions and 9 deletions

View File

@ -3262,7 +3262,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)
@ -3285,9 +3284,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;
@ -3448,6 +3444,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( wcslen( 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;

View File

@ -3900,8 +3900,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);
@ -3909,10 +3907,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");
ok(ffvi->VolumeSerialNumber != 0, "Missing VolumeSerialNumber\n");
todo_wine ok(ffvi->VolumeCreationTime.QuadPart != 0, "Missing VolumeCreationTime\n");
todo_wine 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));