mountmgr: Return the filesystem type from IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE.

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:29 -05:00 committed by Alexandre Julliard
parent 37ed655903
commit cf174edfd9
4 changed files with 29 additions and 3 deletions

View File

@ -1618,7 +1618,8 @@ NTSTATUS remove_dos_device( int letter, const char *udi )
}
/* query information about an existing dos drive, by letter or udi */
NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point )
NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type,
char **device, char **mount_point )
{
NTSTATUS status = STATUS_NO_SUCH_DEVICE;
struct dos_drive *drive;
@ -1630,6 +1631,18 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, ch
if (drive->drive != letter) continue;
disk_device = drive->volume->device;
if (type) *type = disk_device->type;
if (fs_type)
{
switch (drive->volume->fs_type)
{
case FS_ISO9660: *fs_type = MOUNTMGR_FS_TYPE_ISO9660; break;
case FS_UDF: *fs_type = MOUNTMGR_FS_TYPE_UDF; break;
case FS_FAT1216: *fs_type = MOUNTMGR_FS_TYPE_FAT; break;
case FS_FAT32: *fs_type = MOUNTMGR_FS_TYPE_FAT32; break;
default: *fs_type = MOUNTMGR_FS_TYPE_NTFS; break;
}
*fs_type = drive->volume->fs_type;
}
if (device) *device = strdupA( disk_device->unix_device );
if (mount_point) *mount_point = strdupA( disk_device->unix_mount );
status = STATUS_SUCCESS;

View File

@ -295,12 +295,13 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize,
int letter = tolowerW( input->letter );
NTSTATUS status;
DWORD size, type = DEVICE_UNKNOWN;
enum mountmgr_fs_type fs_type;
enum device_type device_type;
char *ptr;
if (letter < 'a' || letter > 'z') return STATUS_INVALID_PARAMETER;
if ((status = query_dos_device( letter - 'a', &device_type, &device, &mount_point ))) return status;
if ((status = query_dos_device( letter - 'a', &device_type, &fs_type, &device, &mount_point ))) return status;
switch (device_type)
{
case DEVICE_UNKNOWN: type = DRIVE_UNKNOWN; break;
@ -322,6 +323,7 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize,
output->size = size;
output->letter = letter;
output->type = type;
output->fs_type = fs_type;
output->mount_point_offset = 0;
output->device_offset = 0;

View File

@ -57,7 +57,8 @@ extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device,
const char *mount_point, enum device_type type, const GUID *guid,
UNICODE_STRING *devname ) DECLSPEC_HIDDEN;
extern NTSTATUS remove_dos_device( int letter, const char *udi ) DECLSPEC_HIDDEN;
extern NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point ) DECLSPEC_HIDDEN;
extern NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type,
char **device, char **mount_point ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI serial_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN;
extern NTSTATUS WINAPI parallel_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN;

View File

@ -52,10 +52,20 @@ static const WCHAR MOUNTMGR_DOS_DEVICE_NAME[] = {'\\','\\','.','\\','M','o','u',
#define IOCTL_MOUNTMGR_DEFINE_UNIX_DRIVE CTL_CODE(MOUNTMGRCONTROLTYPE, 32, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
#define IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE CTL_CODE(MOUNTMGRCONTROLTYPE, 33, METHOD_BUFFERED, FILE_READ_ACCESS)
enum mountmgr_fs_type
{
MOUNTMGR_FS_TYPE_NTFS,
MOUNTMGR_FS_TYPE_FAT,
MOUNTMGR_FS_TYPE_FAT32,
MOUNTMGR_FS_TYPE_ISO9660,
MOUNTMGR_FS_TYPE_UDF,
};
struct mountmgr_unix_drive
{
ULONG size;
ULONG type;
ULONG fs_type;
WCHAR letter;
USHORT mount_point_offset;
USHORT device_offset;