Zebediah Figura : mountmgr: Return the filesystem type from IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE.

Alexandre Julliard julliard at winehq.org
Mon Apr 6 15:53:21 CDT 2020


Module: wine
Branch: master
Commit: cf174edfd940007bfe4857c4f254479e18f79ef0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=cf174edfd940007bfe4857c4f254479e18f79ef0

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Mar 27 10:32:29 2020 -0500

mountmgr: Return the filesystem type from IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mountmgr.sys/device.c   | 15 ++++++++++++++-
 dlls/mountmgr.sys/mountmgr.c |  4 +++-
 dlls/mountmgr.sys/mountmgr.h |  3 ++-
 include/ddk/mountmgr.h       | 10 ++++++++++
 4 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 1459386f06..8917136336 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -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;
diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c
index 21712dc9ce..3a1b20af37 100644
--- a/dlls/mountmgr.sys/mountmgr.c
+++ b/dlls/mountmgr.sys/mountmgr.c
@@ -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;
 
diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h
index b7fb7d8658..26901499ac 100644
--- a/dlls/mountmgr.sys/mountmgr.h
+++ b/dlls/mountmgr.sys/mountmgr.h
@@ -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;
diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h
index d6b0ed21df..b28d6b17de 100644
--- a/include/ddk/mountmgr.h
+++ b/include/ddk/mountmgr.h
@@ -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;




More information about the wine-cvs mailing list