Commit 134feaab authored by Alexandre Julliard's avatar Alexandre Julliard

mountmgr: Return a copy of the strings in query_dos_device.

parent 15acd35f
...@@ -807,8 +807,7 @@ NTSTATUS remove_dos_device( int letter, const char *udi ) ...@@ -807,8 +807,7 @@ NTSTATUS remove_dos_device( int letter, const char *udi )
} }
/* 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, NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point )
const char **device, const char **mount_point )
{ {
struct dos_drive *drive; struct dos_drive *drive;
struct disk_device *disk_device; struct disk_device *disk_device;
...@@ -818,8 +817,8 @@ NTSTATUS query_dos_device( int letter, enum device_type *type, ...@@ -818,8 +817,8 @@ NTSTATUS query_dos_device( int letter, enum device_type *type,
if (drive->drive != letter) continue; if (drive->drive != letter) continue;
disk_device = drive->volume->device; disk_device = drive->volume->device;
if (type) *type = disk_device->type; if (type) *type = disk_device->type;
if (device) *device = disk_device->unix_device; if (device) *device = strdupA( disk_device->unix_device );
if (mount_point) *mount_point = disk_device->unix_mount; if (mount_point) *mount_point = strdupA( disk_device->unix_mount );
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
return STATUS_NO_SUCH_DEVICE; return STATUS_NO_SUCH_DEVICE;
......
...@@ -276,7 +276,7 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize, ...@@ -276,7 +276,7 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize,
{ {
const struct mountmgr_unix_drive *input = in_buff; const struct mountmgr_unix_drive *input = in_buff;
struct mountmgr_unix_drive *output = out_buff; struct mountmgr_unix_drive *output = out_buff;
const 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;
...@@ -314,7 +314,8 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize, ...@@ -314,7 +314,8 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize,
output->type = type; output->type = type;
iosb->Information = FIELD_OFFSET( struct mountmgr_unix_drive, type ) + sizeof(output->type); iosb->Information = FIELD_OFFSET( struct mountmgr_unix_drive, type ) + sizeof(output->type);
} }
return STATUS_MORE_ENTRIES; status = STATUS_MORE_ENTRIES;
goto done;
} }
output->size = size; output->size = size;
output->letter = letter; output->letter = letter;
...@@ -341,7 +342,10 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize, ...@@ -341,7 +342,10 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize,
letter, debugstr_a(device), debugstr_a(mount_point), type ); letter, debugstr_a(device), debugstr_a(mount_point), type );
iosb->Information = ptr - (char *)output; iosb->Information = ptr - (char *)output;
return STATUS_SUCCESS; done:
RtlFreeHeap( GetProcessHeap(), 0, device );
RtlFreeHeap( GetProcessHeap(), 0, mount_point );
return status;
} }
/* handler for ioctls on the mount manager device */ /* handler for ioctls on the mount manager device */
......
...@@ -57,8 +57,7 @@ extern NTSTATUS remove_volume( const char *udi ); ...@@ -57,8 +57,7 @@ extern NTSTATUS remove_volume( const char *udi );
extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device, 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 );
extern NTSTATUS remove_dos_device( int letter, const char *udi ); extern NTSTATUS remove_dos_device( int letter, const char *udi );
extern NTSTATUS query_dos_device( int letter, enum device_type *type, extern NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point );
const char **device, const char **mount_point );
extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path ); extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path );
/* mount point functions */ /* mount point functions */
......
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