Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/mountmgr.sys/device.c | 18 ++++++++++++++++-- dlls/mountmgr.sys/mountmgr.c | 20 +++++++++++++++++--- dlls/mountmgr.sys/mountmgr.h | 7 ++++--- include/ddk/mountmgr.h | 2 ++ 4 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c index 5aac45c6508..b99548aad27 100644 --- a/dlls/mountmgr.sys/device.c +++ b/dlls/mountmgr.sys/device.c @@ -157,6 +157,15 @@ static char *strdupA( const char *str ) return ret; }
+static WCHAR *strdupW( const WCHAR *str ) +{ + WCHAR *ret; + + if (!str) return NULL; + if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, (strlenW(str) + 1) * sizeof(WCHAR) ))) strcpyW( ret, str ); + return ret; +} + static const GUID *get_default_uuid( int letter ) { static GUID guid; @@ -1636,7 +1645,7 @@ enum mountmgr_fs_type get_mountmgr_fs_type(enum fs_type fs_type)
/* query information about an existing dos drive, by letter or udi */ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type, - char **device, char **mount_point ) + DWORD *serial, char **device, char **mount_point, WCHAR **label ) { NTSTATUS status = STATUS_NO_SUCH_DEVICE; struct dos_drive *drive; @@ -1649,8 +1658,10 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_ disk_device = drive->volume->device; if (type) *type = disk_device->type; if (fs_type) *fs_type = get_mountmgr_fs_type( drive->volume->fs_type ); + if (serial) *serial = drive->volume->serial; if (device) *device = strdupA( disk_device->unix_device ); if (mount_point) *mount_point = strdupA( disk_device->unix_mount ); + if (label) *label = strdupW( drive->volume->label ); status = STATUS_SUCCESS; break; } @@ -1660,7 +1671,8 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_
/* query information about an existing unix device, by dev_t */ NTSTATUS query_unix_device( unsigned int major, unsigned int minor, enum device_type *type, - enum mountmgr_fs_type *fs_type, char **device, char **mount_point ) + enum mountmgr_fs_type *fs_type, DWORD *serial, char **device, + char **mount_point, WCHAR **label ) { NTSTATUS status = STATUS_NO_SUCH_DEVICE; struct volume *volume; @@ -1679,8 +1691,10 @@ NTSTATUS query_unix_device( unsigned int major, unsigned int minor, enum device_
if (type) *type = disk_device->type; if (fs_type) *fs_type = get_mountmgr_fs_type( volume->fs_type ); + if (serial) *serial = volume->serial; if (device) *device = strdupA( disk_device->unix_device ); if (mount_point) *mount_point = strdupA( disk_device->unix_mount ); + if (label) *label = strdupW( volume->label ); status = STATUS_SUCCESS; break; } diff --git a/dlls/mountmgr.sys/mountmgr.c b/dlls/mountmgr.sys/mountmgr.c index 1ba66de7cbc..d9d09160202 100644 --- a/dlls/mountmgr.sys/mountmgr.c +++ b/dlls/mountmgr.sys/mountmgr.c @@ -286,22 +286,25 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, char *device, *mount_point; int letter = tolowerW( input->letter ); NTSTATUS status; - DWORD size, type = DEVICE_UNKNOWN; + DWORD size, type = DEVICE_UNKNOWN, serial; enum mountmgr_fs_type fs_type; enum device_type device_type; char *ptr; + WCHAR *label;
if (!letter) { if ((status = query_unix_device( input->major, input->minor, &device_type, - &fs_type, &device, &mount_point ))) + &fs_type, &serial, &device, &mount_point, &label ))) return status; } else { if (letter < 'a' || letter > 'z') return STATUS_INVALID_PARAMETER;
- if ((status = query_dos_device( letter - 'a', &device_type, &fs_type, &device, &mount_point ))) return status; + if ((status = query_dos_device( letter - 'a', &device_type, &fs_type, &serial, &device, + &mount_point, &label ))) + return status; }
switch (device_type) @@ -326,8 +329,10 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, output->letter = letter; output->type = type; output->fs_type = fs_type; + output->serial = serial; output->mount_point_offset = 0; output->device_offset = 0; + output->label_offset = 0;
if (size > outsize) { @@ -364,6 +369,14 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, } else output->device_offset = 0;
+ if (label) + { + output->label_offset = ptr - (char *)output; + strcpyW( (WCHAR *)ptr, label ); + ptr += (strlenW(label) + 1) * sizeof(WCHAR); + } + else output->label_offset = 0; + TRACE( "returning %c: dev %s mount %s type %u\n", letter, debugstr_a(device), debugstr_a(mount_point), type );
@@ -371,6 +384,7 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, done: RtlFreeHeap( GetProcessHeap(), 0, device ); RtlFreeHeap( GetProcessHeap(), 0, mount_point ); + RtlFreeHeap( GetProcessHeap(), 0, label ); return status; }
diff --git a/dlls/mountmgr.sys/mountmgr.h b/dlls/mountmgr.sys/mountmgr.h index 15893592976..469d83335b9 100644 --- a/dlls/mountmgr.sys/mountmgr.h +++ b/dlls/mountmgr.sys/mountmgr.h @@ -57,10 +57,11 @@ 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, enum mountmgr_fs_type *fs_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, DWORD *serial, + char **device, char **mount_point, WCHAR **label ) DECLSPEC_HIDDEN; extern NTSTATUS query_unix_device( unsigned int major, unsigned int minor, enum device_type *type, - enum mountmgr_fs_type *fs_type, char **device, char **mount_point ) DECLSPEC_HIDDEN; + DWORD *serial, enum mountmgr_fs_type *fs_type, char **device, + char **mount_point, WCHAR **label ) 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 4271333204e..3ef74a84970 100644 --- a/include/ddk/mountmgr.h +++ b/include/ddk/mountmgr.h @@ -67,9 +67,11 @@ struct mountmgr_unix_drive ULONG type; ULONG fs_type; ULONG major, minor; + DWORD serial; WCHAR letter; USHORT mount_point_offset; USHORT device_offset; + USHORT label_offset; };
#define IOCTL_MOUNTMGR_QUERY_DHCP_REQUEST_PARAMS CTL_CODE(MOUNTMGRCONTROLTYPE, 64, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)