mountmgr: Return a copy of the strings in query_dos_device.

This commit is contained in:
Alexandre Julliard 2009-07-22 21:02:47 +02:00
parent 15acd35fa2
commit 134feaab05
3 changed files with 11 additions and 9 deletions

View File

@ -807,8 +807,7 @@ 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,
const char **device, const char **mount_point )
NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point )
{
struct dos_drive *drive;
struct disk_device *disk_device;
@ -818,8 +817,8 @@ NTSTATUS query_dos_device( int letter, enum device_type *type,
if (drive->drive != letter) continue;
disk_device = drive->volume->device;
if (type) *type = disk_device->type;
if (device) *device = disk_device->unix_device;
if (mount_point) *mount_point = disk_device->unix_mount;
if (device) *device = strdupA( disk_device->unix_device );
if (mount_point) *mount_point = strdupA( disk_device->unix_mount );
return STATUS_SUCCESS;
}
return STATUS_NO_SUCH_DEVICE;

View File

@ -276,7 +276,7 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize,
{
const struct mountmgr_unix_drive *input = in_buff;
struct mountmgr_unix_drive *output = out_buff;
const char *device, *mount_point;
char *device, *mount_point;
int letter = tolowerW( input->letter );
NTSTATUS status;
DWORD size, type = DEVICE_UNKNOWN;
@ -314,7 +314,8 @@ static NTSTATUS query_unix_drive( const void *in_buff, SIZE_T insize,
output->type = 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->letter = letter;
@ -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 );
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 */

View File

@ -57,8 +57,7 @@ extern NTSTATUS remove_volume( const char *udi );
extern NTSTATUS add_dos_device( int letter, const char *udi, const char *device,
const char *mount_point, enum device_type type, const GUID *guid );
extern NTSTATUS remove_dos_device( int letter, const char *udi );
extern NTSTATUS query_dos_device( int letter, enum device_type *type,
const char **device, const char **mount_point );
extern NTSTATUS query_dos_device( int letter, enum device_type *type, char **device, char **mount_point );
extern NTSTATUS WINAPI harddisk_driver_entry( DRIVER_OBJECT *driver, UNICODE_STRING *path );
/* mount point functions */