Commit 19b8aadf authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

mountmgr: Return the serial and label from IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE.

parent 18a960bb
...@@ -152,6 +152,15 @@ static char *strdupA( const char *str ) ...@@ -152,6 +152,15 @@ static char *strdupA( const char *str )
return ret; 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 const GUID *get_default_uuid( int letter )
{ {
static GUID guid; static GUID guid;
...@@ -1631,7 +1640,7 @@ enum mountmgr_fs_type get_mountmgr_fs_type(enum fs_type fs_type) ...@@ -1631,7 +1640,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 */ /* 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, 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; NTSTATUS status = STATUS_NO_SUCH_DEVICE;
struct dos_drive *drive; struct dos_drive *drive;
...@@ -1644,8 +1653,10 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_ ...@@ -1644,8 +1653,10 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_
disk_device = drive->volume->device; disk_device = drive->volume->device;
if (type) *type = disk_device->type; if (type) *type = disk_device->type;
if (fs_type) *fs_type = get_mountmgr_fs_type( drive->volume->fs_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 (device) *device = strdupA( disk_device->unix_device );
if (mount_point) *mount_point = strdupA( disk_device->unix_mount ); if (mount_point) *mount_point = strdupA( disk_device->unix_mount );
if (label) *label = strdupW( drive->volume->label );
status = STATUS_SUCCESS; status = STATUS_SUCCESS;
break; break;
} }
...@@ -1655,7 +1666,8 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_ ...@@ -1655,7 +1666,8 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_
/* query information about an existing unix device, by dev_t */ /* query information about an existing unix device, by dev_t */
NTSTATUS query_unix_device( ULONGLONG unix_dev, enum device_type *type, NTSTATUS query_unix_device( ULONGLONG unix_dev, 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; NTSTATUS status = STATUS_NO_SUCH_DEVICE;
struct volume *volume; struct volume *volume;
...@@ -1674,8 +1686,10 @@ NTSTATUS query_unix_device( ULONGLONG unix_dev, enum device_type *type, ...@@ -1674,8 +1686,10 @@ NTSTATUS query_unix_device( ULONGLONG unix_dev, enum device_type *type,
if (type) *type = disk_device->type; if (type) *type = disk_device->type;
if (fs_type) *fs_type = get_mountmgr_fs_type( volume->fs_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 (device) *device = strdupA( disk_device->unix_device );
if (mount_point) *mount_point = strdupA( disk_device->unix_mount ); if (mount_point) *mount_point = strdupA( disk_device->unix_mount );
if (label) *label = strdupW( volume->label );
status = STATUS_SUCCESS; status = STATUS_SUCCESS;
break; break;
} }
......
...@@ -294,22 +294,25 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, ...@@ -294,22 +294,25 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize,
char *device, *mount_point; char *device, *mount_point;
int letter = tolowerW( input->letter ); int letter = tolowerW( input->letter );
NTSTATUS status; NTSTATUS status;
DWORD size, type = DEVICE_UNKNOWN; DWORD size, type = DEVICE_UNKNOWN, serial;
enum mountmgr_fs_type fs_type; enum mountmgr_fs_type fs_type;
enum device_type device_type; enum device_type device_type;
char *ptr; char *ptr;
WCHAR *label;
if (!letter) if (!letter)
{ {
if ((status = query_unix_device( input->unix_dev, &device_type, if ((status = query_unix_device( input->unix_dev, &device_type, &fs_type,
&fs_type, &device, &mount_point ))) &serial, &device, &mount_point, &label )))
return status; return status;
} }
else else
{ {
if (letter < 'a' || letter > 'z') return STATUS_INVALID_PARAMETER; 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) switch (device_type)
...@@ -334,8 +337,10 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, ...@@ -334,8 +337,10 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize,
output->letter = letter; output->letter = letter;
output->type = type; output->type = type;
output->fs_type = fs_type; output->fs_type = fs_type;
output->serial = serial;
output->mount_point_offset = 0; output->mount_point_offset = 0;
output->device_offset = 0; output->device_offset = 0;
output->label_offset = 0;
if (size > outsize) if (size > outsize)
{ {
...@@ -372,6 +377,14 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, ...@@ -372,6 +377,14 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize,
} }
else output->device_offset = 0; 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", TRACE( "returning %c: dev %s mount %s type %u\n",
letter, debugstr_a(device), debugstr_a(mount_point), type ); letter, debugstr_a(device), debugstr_a(mount_point), type );
...@@ -379,6 +392,7 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize, ...@@ -379,6 +392,7 @@ static NTSTATUS query_unix_drive( void *buff, SIZE_T insize,
done: done:
RtlFreeHeap( GetProcessHeap(), 0, device ); RtlFreeHeap( GetProcessHeap(), 0, device );
RtlFreeHeap( GetProcessHeap(), 0, mount_point ); RtlFreeHeap( GetProcessHeap(), 0, mount_point );
RtlFreeHeap( GetProcessHeap(), 0, label );
return status; return status;
} }
......
...@@ -57,10 +57,11 @@ extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device, ...@@ -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, const char *mount_point, enum device_type type, const GUID *guid,
UNICODE_STRING *devname ) DECLSPEC_HIDDEN; UNICODE_STRING *devname ) DECLSPEC_HIDDEN;
extern NTSTATUS remove_dos_device( int letter, const char *udi ) 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, extern NTSTATUS query_dos_device( int letter, enum device_type *type, enum mountmgr_fs_type *fs_type, DWORD *serial,
char **device, char **mount_point ) DECLSPEC_HIDDEN; char **device, char **mount_point, WCHAR **label ) DECLSPEC_HIDDEN;
extern NTSTATUS query_unix_device( ULONGLONG unix_dev, enum device_type *type, extern NTSTATUS query_unix_device( ULONGLONG unix_dev, 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 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 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; extern NTSTATUS WINAPI parallel_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ) DECLSPEC_HIDDEN;
......
...@@ -66,10 +66,12 @@ struct mountmgr_unix_drive ...@@ -66,10 +66,12 @@ struct mountmgr_unix_drive
ULONG size; ULONG size;
ULONG type; ULONG type;
ULONG fs_type; ULONG fs_type;
DWORD serial;
ULONGLONG unix_dev; ULONGLONG unix_dev;
WCHAR letter; WCHAR letter;
USHORT mount_point_offset; USHORT mount_point_offset;
USHORT device_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) #define IOCTL_MOUNTMGR_QUERY_DHCP_REQUEST_PARAMS CTL_CODE(MOUNTMGRCONTROLTYPE, 64, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment